diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-01 03:04:54 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-01 03:04:54 +0000 |
commit | 42b8b86c2abf1140ff5c8d74d48d4ece7deb56d7 (patch) | |
tree | 0ce11a1fcd5e2aecf881cc009d2fb14e55069de8 /win32/win32.c | |
parent | 8e858c0b3848dae7efc722f353d7f17ce1333a30 (diff) | |
download | perl-42b8b86c2abf1140ff5c8d74d48d4ece7deb56d7.tar.gz |
support kill(0,$pid) on Windows to test if process exists
p4raw-id: //depot/perl@5386
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 4a7f091797..54f0455851 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -989,6 +989,8 @@ win32_kill(int pid, int sig) /* it is a pseudo-forked child */ long child = find_pseudo_pid(-pid); if (child >= 0) { + if (!sig) + return 0; hProcess = w32_pseudo_child_handles[child]; if (TerminateThread(hProcess, sig)) { remove_dead_pseudo_process(child); @@ -1001,6 +1003,8 @@ win32_kill(int pid, int sig) { long child = find_pid(pid); if (child >= 0) { + if (!sig) + return 0; hProcess = w32_child_handles[child]; if (TerminateProcess(hProcess, sig)) { remove_dead_process(child); @@ -1009,9 +1013,13 @@ win32_kill(int pid, int sig) } else { hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid); - if (hProcess && TerminateProcess(hProcess, sig)) { - CloseHandle(hProcess); - return 0; + if (hProcess) { + if (!sig) + return 0; + if (TerminateProcess(hProcess, sig)) { + CloseHandle(hProcess); + return 0; + } } } } |