Skip to content

Commit 7c65731

Browse files
committed
kill: Handle Win32 console processes' children, too
This change is the equivalent to the change to the Ctrl+C handling we just made. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent cd30e91 commit 7c65731

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

winsup/utils/kill.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,14 @@ forcekill (int pid, int sig, int wait)
171171
return;
172172
}
173173
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
174-
if (sig && !TerminateProcess (h, sig << 8)
175-
&& WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
176-
fprintf (stderr, "%s: couldn't kill pid %u, %u\n",
174+
{
175+
if (sig == SIGINT || sig == SIGTERM)
176+
kill_process_tree (dwpid, sig);
177+
else if (sig && !TerminateProcess (h, sig << 8)
178+
&& WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
179+
fprintf (stderr, "%s: couldn't kill pid %u, %u\n",
177180
prog_name, (unsigned) dwpid, (unsigned int) GetLastError ());
181+
}
178182
CloseHandle (h);
179183
}
180184

0 commit comments

Comments
 (0)