Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Working with other processes and programs

by DeadPoet (Scribe)
on Jan 09, 2011 at 15:49 UTC ( #881361=note: print w/ replies, xml ) Need Help??


in reply to Re: Working with other processes and programs
in thread Working with other processes and programs

Other thoughts to consider when evaluating return codes can include how the process was created. For example, if one uses the IPC::Open3 module to run the external command and the processes (pid) is killed using 'kill( 9, $pid )' the '$? >> 8' evaluation may result in 0. This is probably not the expected value, seeing how the processes was terminated. However, if one inspects the '${^CHILD_ERROR_NATIVE}' the result would show an exit value of 9.

According to PerlDoc:

If the filehandle came from a piped open, close returns false if one of the other syscalls involved fails or if its program exits with non-zero status. If the only problem was that the program exited non-zero, $! will be set to 0. Closing a pipe also waits for the process executing on the pipe to exit--in case you wish to look at the output of the pipe afterwards--and implicitly puts the exit status value of that command into $? and ${^CHILD_ERROR_NATIVE}.

http://search.cpan.org/~jesse/perl-5.12.2/pod/perlfunc.pod

Admittedly this may be a result of how things are terminated, closed and cleaned up. But it is a thought to consider.


Comment on Re^2: Working with other processes and programs

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-08-01 17:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (36 votes), past polls