in reply to Killing on Windows
You're being told the process still exists, which it will until all handles to it have been closed. In unix parlance, the child is zombie at that point. Processes exist in that state in order to allow their parent to collect their exit code. wait and waitpid collect the exit code and close the handle.
my $pid = system(1, $^X, -e => 'sleep 30 while 1') or die("system,1: $!\n"); kill(9, $pid) or die("kill: $!\n"); if (kill(0, $pid)) { print("Process $pid still exists\n") ; } else { print("kill 0: $!\n") ; } waitpid($pid, 0) or die("waitpid: $!\n"); if (kill(0, $pid)) { print("Process $pid still exists\n") ; } else { print("kill 0: $!\n") ; }
Process 4912 still exists kill 0: Invalid argument
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Killing on Windows
by rovf (Priest) on Sep 10, 2009 at 08:00 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2009 at 10:28 UTC | |
by rovf (Priest) on Sep 10, 2009 at 10:52 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2009 at 11:03 UTC | |
by rovf (Priest) on Sep 10, 2009 at 11:32 UTC | |
|