mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-01 07:38:46 +00:00
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:
parent
d88bee3a57
commit
d83e51a8a2
4 changed files with 5 additions and 6 deletions
|
@ -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 {
|
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.
|
// If one of our jobs ended with SIGINT, we stop execution.
|
||||||
// Likewise if fish itself got a SIGINT, or if something ran exit, etc.
|
// 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;
|
return end_execution_reason_t::cancelled;
|
||||||
}
|
}
|
||||||
const auto &ld = parser->libdata();
|
const auto &ld = parser->libdata();
|
||||||
|
|
|
@ -951,7 +951,7 @@ void job_t::continue_job(parser_t &parser) {
|
||||||
parser.libdata().is_interactive ? L"INTERACTIVE" : L"NON-INTERACTIVE");
|
parser.libdata().is_interactive ? L"INTERACTIVE" : L"NON-INTERACTIVE");
|
||||||
|
|
||||||
// Wait for the status of our own job to change.
|
// 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);
|
process_mark_finished_children(parser, true);
|
||||||
}
|
}
|
||||||
if (is_completed()) {
|
if (is_completed()) {
|
||||||
|
|
|
@ -963,7 +963,7 @@ static void term_steal() {
|
||||||
termsize_container_t::shared().invalidate_tty();
|
termsize_container_t::shared().invalidate_tty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_cancel_from_fish_signal() {
|
bool fish_is_unwinding_for_exit() {
|
||||||
switch (s_exit_state) {
|
switch (s_exit_state) {
|
||||||
case exit_state_t::none:
|
case exit_state_t::none:
|
||||||
// Cancel if we got SIGHUP.
|
// Cancel if we got SIGHUP.
|
||||||
|
|
|
@ -234,9 +234,8 @@ void reader_pop();
|
||||||
/// The readers interrupt signal handler. Cancels all currently running blocks.
|
/// The readers interrupt signal handler. Cancels all currently running blocks.
|
||||||
void reader_handle_sigint();
|
void reader_handle_sigint();
|
||||||
|
|
||||||
/// \return whether we should cancel fish script due to fish itself receiving a signal.
|
/// \return whether fish is currently unwinding the stack in preparation to exit.
|
||||||
/// TODO: this doesn't belong in reader.
|
bool fish_is_unwinding_for_exit();
|
||||||
bool check_cancel_from_fish_signal();
|
|
||||||
|
|
||||||
/// Given a command line and an autosuggestion, return the string that gets shown to the user.
|
/// Given a command line and an autosuggestion, return the string that gets shown to the user.
|
||||||
/// Exposed for testing purposes only.
|
/// Exposed for testing purposes only.
|
||||||
|
|
Loading…
Reference in a new issue