|
Hi,
I am running v5.6.1 under win2k. I have been having
problem getting the correct child pid.
The child $pid is always a negative number for some
reason. $pid gives the same negative
as $$ in the child process code but that is not the
real child pid.
$$ in parent code did give the correct pid
number.
Basically, I need to trigger an external program..
Get some data from the external program and
process the data. Then force the external program
to exit. (I don't think I need to use waitpid in
this case).
Is there someone out there familiar with this pid
problem?
@execARGS = ("notepad");
if ($pid = fork) { print "parent:$$\n"; sleep(3); kill QUIT => $pid; print "parent kill child:$pid\n"; } else { die "cannot fork: $!" unless defined $pid; print "child:$$\n"; exec @execARGS or die "Couldn't executed $!\n"; print "child killed\n"; } # waitpid($pid,0);
Thanks,
Ed
|
