in reply to Re: sigchild and $?
in thread sigchild and $?

I would love to say I had a reason for not using waitpid(), but that might be a stretch. I will play around with that a bit. I did find a work around - if interested:
@ScriptMSG=`/run/some/script;/usr/echo "\$?"`; chomp(@ScriptMSG); $ExitCode=$ScriptMsg[$#ScriptMsg];
-Bryan

Replies are listed 'Best First'.
Re: Re: Re: sigchild and $?
by bluto (Curate) on Oct 01, 2003 at 15:58 UTC
    I wasn't thinking straight -- forget my comment about waitpid() which you would need if you did your own fork/exec. You don't need it with backticks. Basically backticks sets $? so you can check it directly (by using this code ripped from 'perldoc -f system'...
    $exit_value = $? >> 8; $signal_num = $? & 127; $dumped_core = $? & 128;
    bluto