in reply to Why cant i save output of tasklist.exe in an array?
G'day swissknife,
I see you got a couple of quick replies to your immediate problem.
For future reference, check this from open:
"If the open involved a pipe, the return value happens to be the pid of the subprocess."
And this from kill:
"If SIGNAL is either the number 0 or ... This is useful to check that a child process is still alive ..."
[Read the full details, caveats, portability issues and so on for both of those.]
As a general technique for checking on this sort of process, you can do something along these lines:
my $pid = open my $pipe, '-|', ... ... if (kill 0 => $pid) { # actions if process alive } else { # actions if process not alive }
-- Ken
|
|---|