From e3d50157ce21f990c33afdcf8dba8080308ce0f0 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 13 Sep 2023 10:05:56 +0100 Subject: ash: fix signal handling Commit 89aa9d783 (win32: changes to signal handling) caused a regression: 'httpd -f' could no longer be interrupted by Ctrl-C. The specific issue is the use of exit(2) to replace raise(3) in raise_interrupt(). This change was made so the shell would return the expected exit code of 130 rather than the default code of 3 which Windows uses when a signal with SIG_DFL disposition is caught. The problem can be avoided by calling _exit(2) instead. A call to fflush_all() has also been added, as _exit(2) doesn't do that. (GitHub issue #365) --- shell/ash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/ash.c b/shell/ash.c index a19a3c686..dcc73031f 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -955,7 +955,8 @@ raise_interrupt(void) signal(SIGINT, SIG_DFL); raise(SIGINT); #else - exit(SIGINT << 24); + fflush_all(); + _exit(SIGINT << 24); #endif } #if ENABLE_PLATFORM_MINGW32 -- cgit v1.2.3-55-g6feb