Skip to content

Commit e8c4047

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 <johannes.schindelin@gmx.de>
1 parent a5f1ead commit e8c4047

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
@@ -174,10 +174,14 @@ forcekill (int pid, int sig, int wait)
174174
return;
175175
}
176176
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
177-
if (sig && !TerminateProcess (h, sig << 8)
178-
&& WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
179-
fprintf (stderr, "%s: couldn't kill pid %u, %u\n",
177+
{
178+
if (sig == SIGINT || sig == SIGTERM)
179+
kill_process_tree (dwpid, sig);
180+
else if (sig && !TerminateProcess (h, sig << 8)
181+
&& WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
182+
fprintf (stderr, "%s: couldn't kill pid %u, %u\n",
180183
prog_name, (unsigned) dwpid, (unsigned int) GetLastError ());
184+
}
181185
CloseHandle (h);
182186
}
183187

0 commit comments

Comments
 (0)