summaryrefslogtreecommitdiff
path: root/Shell
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-08-10 22:58:21 +0430
committerAndreas Kling <kling@serenityos.org>2020-08-10 20:50:06 +0200
commit69fc91d9744963752aaa7e73174ea49f60353aeb (patch)
treecec804860b86f0a8d7e113f45d567e062e5c4747 /Shell
parentd777583e2828386a68d869a4c31777bbb3321887 (diff)
downloadserenity-69fc91d9744963752aaa7e73174ea49f60353aeb.zip
Shell: Cancel a running for loop upon receiving any non-SIGINT signal
And keep the old behaviour of needing two interruptions on SIGINT.
Diffstat (limited to 'Shell')
-rw-r--r--Shell/AST.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/Shell/AST.cpp b/Shell/AST.cpp
index 64a9ef86ca..be8d600d69 100644
--- a/Shell/AST.cpp
+++ b/Shell/AST.cpp
@@ -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;
+ }
}
}