Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to Trap exit code from system calls

by tcf22 (Priest)
on Jan 21, 2004 at 15:59 UTC ( #322916=note: print w/replies, xml ) Need Help??


in reply to How to Trap exit code from system calls

You could always just use a system call. Below is what the docs say about checking exit values and such.
Because system() and backticks block SIGINT and SIGQUIT, killing the p +rogram they're running doesn't actually interrupt your program. @args = ("command", "arg1", "arg2"); system(@args) == 0 or die "system @args failed: $?" You can check all the failure possibilities by inspecting $? like this +: $exit_value = $? >> 8; $signal_num = $? & 127; $dumped_core = $? & 128;

- Tom

Replies are listed 'Best First'.
Re: Re: How to Trap exit code from system calls
by emjga1 (Novice) on Jan 22, 2004 at 11:02 UTC
    Tom

    Thanks , I had looked at $? but did not get the expected answers from it
    and asumed I was doing somthing wrong.

    But using
    $exit_value  = $? >> 8;

    Does just the job.

    Thanks

    Matt

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://322916]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2020-06-05 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (35 votes). Check out past polls.

    Notices?