Rename check_cancel_from_fish_signal to fish_is_unwinding_for_exit

"unwinding_for_exit" mixes up SIGHUP handling and also the exit builtin;
this is still pretty messy.
This commit is contained in:
ridiculousfish 2022-05-28 16:35:40 -07:00
parent d88bee3a57
commit d83e51a8a2
4 changed files with 5 additions and 6 deletions

View file

@ -228,7 +228,7 @@ process_type_t parse_execution_context_t::process_type_for_command(
maybe_t<end_execution_reason_t> parse_execution_context_t::check_end_execution() const {
// If one of our jobs ended with SIGINT, we stop execution.
// Likewise if fish itself got a SIGINT, or if something ran exit, etc.
if (cancel_signal || ctx.check_cancel() || check_cancel_from_fish_signal()) {
if (cancel_signal || ctx.check_cancel() || fish_is_unwinding_for_exit()) {
return end_execution_reason_t::cancelled;
}
const auto &ld = parser->libdata();

View file

@ -951,7 +951,7 @@ void job_t::continue_job(parser_t &parser) {
parser.libdata().is_interactive ? L"INTERACTIVE" : L"NON-INTERACTIVE");
// Wait for the status of our own job to change.
while (!check_cancel_from_fish_signal() && !is_stopped() && !is_completed()) {
while (!fish_is_unwinding_for_exit() && !is_stopped() && !is_completed()) {
process_mark_finished_children(parser, true);
}
if (is_completed()) {

View file

@ -963,7 +963,7 @@ static void term_steal() {
termsize_container_t::shared().invalidate_tty();
}
bool check_cancel_from_fish_signal() {
bool fish_is_unwinding_for_exit() {
switch (s_exit_state) {
case exit_state_t::none:
// Cancel if we got SIGHUP.

View file

@ -234,9 +234,8 @@ void reader_pop();
/// The readers interrupt signal handler. Cancels all currently running blocks.
void reader_handle_sigint();
/// \return whether we should cancel fish script due to fish itself receiving a signal.
/// TODO: this doesn't belong in reader.
bool check_cancel_from_fish_signal();
/// \return whether fish is currently unwinding the stack in preparation to exit.
bool fish_is_unwinding_for_exit();
/// Given a command line and an autosuggestion, return the string that gets shown to the user.
/// Exposed for testing purposes only.