Skip to content

Commit 8dc4ef0

Browse files
committed
Merge pull request #6 from dscho/ctrl-c
When interrupting Win32 processes, kill their child processes, too
2 parents 9659cc0 + fac84ba commit 8dc4ef0

File tree

8 files changed

+666
-7
lines changed

8 files changed

+666
-7
lines changed

winsup/cygwin/exceptions.cc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ details. */
2828
#include "ntdll.h"
2929
#include "exception.h"
3030
#include "posix_timer.h"
31+
#include "cygwin/exit_process.h"
3132

3233
/* Definitions for code simplification */
3334
#ifdef __x86_64__
@@ -1539,8 +1540,23 @@ sigpacket::process ()
15391540
dosig:
15401541
if (have_execed)
15411542
{
1542-
sigproc_printf ("terminating captive process");
1543-
TerminateProcess (ch_spawn, sigExeced = si.si_signo);
1543+
switch (si.si_signo)
1544+
{
1545+
case SIGUSR1:
1546+
case SIGUSR2:
1547+
case SIGCONT:
1548+
case SIGSTOP:
1549+
case SIGTSTP:
1550+
case SIGTTIN:
1551+
case SIGTTOU:
1552+
system_printf ("Suppressing signal %d to win32 process (pid %u)",
1553+
(int)si.si_signo, (unsigned int)GetProcessId(ch_spawn));
1554+
goto done;
1555+
default:
1556+
sigproc_printf ("terminating captive process");
1557+
rc = exit_process_tree (ch_spawn, 128 + (sigExeced = si.si_signo));
1558+
goto done;
1559+
}
15441560
}
15451561
/* Dispatch to the appropriate function. */
15461562
sigproc_printf ("signal %d, signal handler %p", si.si_signo, handler);

0 commit comments

Comments
 (0)