aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-03-27 14:35:53 +0100
committerRon Yorston <rmy@pobox.com>2018-03-27 14:35:53 +0100
commitb8d57003cf8d175f7b854240d2bf01fcce8f3ffd (patch)
tree5f745b449954e261a148214be8d7d7822fb09622
parentbfffcaeec7c726166e87c801b4a60e3adf88dfd4 (diff)
downloadbusybox-w32-b8d57003cf8d175f7b854240d2bf01fcce8f3ffd.tar.gz
busybox-w32-b8d57003cf8d175f7b854240d2bf01fcce8f3ffd.tar.bz2
busybox-w32-b8d57003cf8d175f7b854240d2bf01fcce8f3ffd.zip
ash: use SIGTERM to kill processes
When Ctrl-C is pressed try killing processes with SIGTERM initially. If they're still running after a short pause use sterner measures.
-rw-r--r--shell/ash.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index c7c514417..586925835 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4472,7 +4472,15 @@ waitpid_child(int *status, int wait_flags)
4472 int i; 4472 int i;
4473 ResetEvent(hSIGINT); 4473 ResetEvent(hSIGINT);
4474 for (i = 1; i < pid_nr; i++) 4474 for (i = 1; i < pid_nr; i++)
4475 TerminateProcess(proclist[i], 1); 4475 kill_SIGTERM_by_handle(proclist[i], 128+SIGINT);
4476 Sleep(200);
4477 for (i = 1; i < pid_nr; i++) {
4478 DWORD code;
4479 if (GetExitCodeProcess(proclist[i], &code) &&
4480 code == STILL_ACTIVE) {
4481 TerminateProcess(proclist[i], 128+SIGINT);
4482 }
4483 }
4476 pid = pidlist[1]; 4484 pid = pidlist[1];
4477 free(pidlist); 4485 free(pidlist);
4478 free(proclist); 4486 free(proclist);