1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

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
parent d777583e28
commit 69fc91d974

View file

@ -777,13 +777,15 @@ 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))
++consecutive_interruptions;
else
if (job->signaled()) {
if (job->termination_signal() == SIGINT)
++consecutive_interruptions;
else
break;
} else {
consecutive_interruptions = 0;
}
}
}