in reply to Detect Process End

system "/bin/ps -p $a" does not return a true when the process is still running

Specifically, system doesn't return at all while the child process is still running. Also, it doesn't provide the output in a variable, which I think you want. Try open(HANDLE, "/bin/ps -p $a |") if you wish to get the info as ps prints it, or use backticks ($info = `/bin/ps -p $a`) if you just want the output when ps is done running.

Replies are listed 'Best First'.
Re^2: Detect Process End
by rcolman (Acolyte) on Nov 27, 2004 at 05:14 UTC
    Please excuse my ignorance, I am really a beginner at this. I don't really want any output at all. I don't want any information back from ps. I just want to get a "true" if the process is still running. TNX if you can get me over this hump.
      Here is a simpler explanation of ikegami(++)'s post:

      What you are trying to do is to keep running "ps -p $a" until you get a null output.

      In order to do that, you need to look at the output of that command.

      The "system" command does NOT provide the output.

      The backticks ($info = `/bin/ps -p $a`) DO provide that, capturing the output into $info.

      You then need to look for a null $info.

          ...each is assigned his own private delusion but he cannot see the baggage on his own back.

        It's a bit hacky - but I've done it myself ;) THe only other trick is you need to use `ps -h -p $a` to omit the ps header (which would otherwise mean you never get a null string).