1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:17:42 +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()) if (!job || job->is_running_in_background())
continue; continue;
shell->block_on_job(job); shell->block_on_job(job);
if (job->signaled()
&& (job->termination_signal() == SIGINT if (job->signaled()) {
|| job->termination_signal() == SIGKILL if (job->termination_signal() == SIGINT)
|| job->termination_signal() == SIGQUIT)) ++consecutive_interruptions;
++consecutive_interruptions; else
else break;
} else {
consecutive_interruptions = 0; consecutive_interruptions = 0;
}
} }
} }