Skip to content

Commit 811f743

Browse files
committed
Merge pull request #6 from dscho/ctrl-c
When interrupting Win32 processes, kill their child processes, too
2 parents 2e34bdd + a7dbeb2 commit 811f743

File tree

4 files changed

+405
-6
lines changed

4 files changed

+405
-6
lines changed

winsup/cygwin/exceptions.cc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ details. */
2727
#include "child_info.h"
2828
#include "ntdll.h"
2929
#include "exception.h"
30+
#include "cygwin/exit_process.h"
3031

3132
/* Definitions for code simplification */
3233
#ifdef __x86_64__
@@ -1532,8 +1533,23 @@ sigpacket::process ()
15321533
dosig:
15331534
if (have_execed)
15341535
{
1535-
sigproc_printf ("terminating captive process");
1536-
TerminateProcess (ch_spawn, sigExeced = si.si_signo);
1536+
switch (si.si_signo)
1537+
{
1538+
case SIGUSR1:
1539+
case SIGUSR2:
1540+
case SIGCONT:
1541+
case SIGSTOP:
1542+
case SIGTSTP:
1543+
case SIGTTIN:
1544+
case SIGTTOU:
1545+
system_printf ("Suppressing signal %d to win32 process (pid %u)",
1546+
(int)si.si_signo, (unsigned int)GetProcessId(ch_spawn));
1547+
goto done;
1548+
default:
1549+
sigproc_printf ("terminating captive process");
1550+
rc = exit_process_tree (ch_spawn, 128 + (sigExeced = si.si_signo));
1551+
goto done;
1552+
}
15371553
}
15381554
/* Dispatch to the appropriate function. */
15391555
sigproc_printf ("signal %d, signal handler %p", si.si_signo, handler);

0 commit comments

Comments
 (0)