Skip to content

Commit 65e334c

Browse files
committed
Refuse to send job control signals to Win32 processes
When calling Win32 processes from MSYS2, it does not really make sense to kill them when a user tries to suspend them. It is much better to warn the user that Win32 processes simply cannot be suspended. This closes git-for-windows/git#1083 and replaces git-for-windows/build-extra#154 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6b60ce5 commit 65e334c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

winsup/cygwin/exceptions.cc

+17-2
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,23 @@ sigpacket::process ()
15471547
dosig:
15481548
if (have_execed)
15491549
{
1550-
sigproc_printf ("terminating captive process");
1551-
exit_process (ch_spawn, 128 + (sigExeced = si.si_signo));
1550+
switch (si.si_signo)
1551+
{
1552+
case SIGUSR1:
1553+
case SIGUSR2:
1554+
case SIGCONT:
1555+
case SIGSTOP:
1556+
case SIGTSTP:
1557+
case SIGTTIN:
1558+
case SIGTTOU:
1559+
system_printf ("Suppressing signal %d to win32 process (pid %u)",
1560+
(int)si.si_signo, (unsigned int)GetProcessId(ch_spawn));
1561+
goto done;
1562+
default:
1563+
sigproc_printf ("terminating captive process");
1564+
exit_process (ch_spawn, 128 + (sigExeced = si.si_signo));
1565+
break;
1566+
}
15521567
}
15531568
/* Dispatch to the appropriate function. */
15541569
sigproc_printf ("signal %d, signal handler %p", si.si_signo, handler);

0 commit comments

Comments
 (0)