Skip to content

Commit

Permalink
Merge pull request #6 from dscho/ctrl-c
Browse files Browse the repository at this point in the history
When interrupting Win32 processes, kill their child processes, too
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Mar 16, 2019
2 parents 51bb37b + 20c57b5 commit bfc966b
Show file tree
Hide file tree
Showing 4 changed files with 405 additions and 6 deletions.
20 changes: 18 additions & 2 deletions winsup/cygwin/exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ details. */
#include "ntdll.h"
#include "exception.h"
#include "posix_timer.h"
#include "cygwin/exit_process.h"

/* Definitions for code simplification */
#ifdef __x86_64__
Expand Down Expand Up @@ -1545,8 +1546,23 @@ sigpacket::process ()
dosig:
if (have_execed)
{
sigproc_printf ("terminating captive process");
TerminateProcess (ch_spawn, sigExeced = si.si_signo);
switch (si.si_signo)
{
case SIGUSR1:
case SIGUSR2:
case SIGCONT:
case SIGSTOP:
case SIGTSTP:
case SIGTTIN:
case SIGTTOU:
system_printf ("Suppressing signal %d to win32 process (pid %u)",
(int)si.si_signo, (unsigned int)GetProcessId(ch_spawn));
goto done;
default:
sigproc_printf ("terminating captive process");
rc = exit_process_tree (ch_spawn, 128 + (sigExeced = si.si_signo));
goto done;
}
}
/* Dispatch to the appropriate function. */
sigproc_printf ("signal %d, signal handler %p", si.si_signo, handler);
Expand Down
Loading

0 comments on commit bfc966b

Please sign in to comment.