diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index f0eee5ff3..994247385 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -228,7 +228,7 @@ process_type_t parse_execution_context_t::process_type_for_command( maybe_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(); diff --git a/src/proc.cpp b/src/proc.cpp index 35f469b3d..99f09f847 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -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()) { diff --git a/src/reader.cpp b/src/reader.cpp index 4fef7c104..79e4318ac 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -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. diff --git a/src/reader.h b/src/reader.h index 0a9bde67f..d80634208 100644 --- a/src/reader.h +++ b/src/reader.h @@ -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.