Skip to content

Commit 090c14b

Browse files
committed
kill() child processes
1 parent e3b1997 commit 090c14b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

contrib/win32/win32compat/signal.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,21 @@ sw_raise(int sig) {
158158

159159
int
160160
sw_kill(int pid, int sig) {
161-
161+
int child_index, i;
162162
if (pid == GetCurrentProcessId())
163163
return sw_raise(sig);
164164

165165
/* for child processes - only SIGTERM supported*/
166166
/* TODO implement kill(SIGTERM) for child processes */
167+
child_index = -1;
168+
for (i = 0; i < children.num_children; i++)
169+
if (children.process_id[i] == pid) {
170+
child_index = i;
171+
break;
172+
}
173+
174+
if (child_index != -1)
175+
TerminateProcess(children.handles[child_index], 0);
167176
return 0;
168177
}
169178

0 commit comments

Comments
 (0)