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 committed Apr 15, 2019
2 parents 612dfe0 + 3f3b93e commit 7e9b8b9
Show file tree
Hide file tree
Showing 8 changed files with 666 additions and 7 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 7e9b8b9

Please sign in to comment.