Shell: Cancel a running for loop upon receiving any non-SIGINT signal

And keep the old behaviour of needing two interruptions on SIGINT.
This commit is contained in:
AnotherTest 2020-08-10 22:58:21 +04:30 committed by Andreas Kling
commit 69fc91d974
Notes: sideshowbarker 2024-07-19 03:54:27 +09:00

View file

@ -777,15 +777,17 @@ RefPtr<Value> ForLoop::run(RefPtr<Shell> shell)
if (!job || job->is_running_in_background())
continue;
shell->block_on_job(job);
if (job->signaled()
&& (job->termination_signal() == SIGINT
|| job->termination_signal() == SIGKILL
|| job->termination_signal() == SIGQUIT))
if (job->signaled()) {
if (job->termination_signal() == SIGINT)
++consecutive_interruptions;
else
break;
} else {
consecutive_interruptions = 0;
}
}
}
return create<ListValue>({});
}