From df34f5e92b1d10f0bb858d2ea6e8c249e87ac593 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 21 Sep 2021 12:52:24 +0100 Subject: ash: improve signal handling Allow waitpid() to detect SIGTERM/SIGKILL by checking the (Windows) status returned by GetExitCodeProcess() and updating the Unix status to suit. This allows ash to detect when a process has been 'signalled'. Provide our own implementation of strsignal(3) which returns expanded text for SIGTERM/SIGKILL. Costs 192 bytes. --- shell/ash.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index f91cd7e1f..613bb97a0 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -4835,6 +4835,8 @@ waitpid_child(int *status, int wait_flags) if (idx < pid_nr) { GetExitCodeProcess(proclist[idx], &win_status); *status = (int)win_status << 8; + if (win_status == 128 + SIGTERM || win_status == 128 + SIGKILL) + *status += win_status - 128; pid = pidlist[idx]; } done: -- cgit v1.2.3-55-g6feb