Hi All
I need to obtain the return code of a process forked via exec. $? appears to always
return 0 even though I know that the actual process had a non-zero return code. Is $?
populated to 0 as the exec was sucessfull ?
If so, how can I get the return code of the process within the exec call ?
Ex.
defined (my $pid = fork) or die "Cannot fork process : $!";
unless ($pid){
exec "$Command";
die "Cannot exec : $Command : $!";
waitpid($pid,0);
}
if ($? != 0 ) {
# $Command returned non-zero return code
}
else {
# $Command returned zero return code
}
I have searched the perldoc for exec as well as perlmonks and cannot find the answer.
Thanks!
Jason
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>