rovf has asked for the wisdom of the Perl Monks concerning the following question:
I have (on Windows) a process started with system(1,...), I have its PID, and I would like to check later whether the process is still running. I can not use waitpid, because this would suspend my program until the process is finished. From the description of the kill function, I thought that sending signal 0 to the process would tell me, whether it is still running:
But this always returns true, even though I can see that the process has already finished long time ago. What am I doing wrong?sub not_running { my $pid=shift; 0 == kill(0,$pid) }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Testing whether a process has finished
by ikegami (Patriarch) on Sep 10, 2009 at 15:17 UTC | |
by ELISHEVA (Prior) on Sep 10, 2009 at 15:39 UTC | |
by ikegami (Patriarch) on Sep 10, 2009 at 16:03 UTC | |
by rovf (Priest) on Sep 11, 2009 at 09:56 UTC | |
by rovf (Priest) on Sep 11, 2009 at 09:41 UTC | |
by ikegami (Patriarch) on Sep 11, 2009 at 14:14 UTC | |
by rovf (Priest) on Sep 11, 2009 at 09:28 UTC | |
by ikegami (Patriarch) on Sep 11, 2009 at 14:26 UTC |