john.goor has asked for the wisdom of the Perl Monks concerning the following question:

Hi! Please help me wih the following: Situation:
  1. (via browser): run.cgi?cmd=test.pl spawns a process running 'test.pl' in the background (Win32::Process::Open)
  2. The output of the spawned process is redirected to a logfile (now the process is independend and alsao the output is saved somewhere)
  3. A redirect takes place to logmonitor.cgi, and the pid is passed on, as well as the name of the logfile
  4. logmonitor.pid starts tailing the log

    NOW THE PROBLEM ARISES!

  5. The tailing takes place as long as the pid exists (at least, it should work that way) The pid is being checked by $obj->GetProcessID()
    But all I get is '0', causing the log not to be tracked at all!

Question: Why does GetProcessID not work when used on a pid that's started in another process? Am i doing s'thing wrong here?

Thanks in advance! :-)

Replies are listed 'Best First'.
Re: GetProcessID problems
by Corion (Patriarch) on Mar 15, 2004 at 10:26 UTC

    When you are talking about PIDs, are you talking about $$ or about the stuff that GetProcessID returns?

    Under Win32, $$ and GetProcessID are/can be different.

    Show us some minimal code reproducing the problem:

    • How do you fill $obj ?
    • How do you spawn test.pl?