Pipe error codes off by a factor of 256

Martin Pool martinp at mincom.com
Tue Dec 21 03:49:54 EST 1999


Mitch Chapman wrote:
> 
> I assume you're talking about the value you get when you
> close the pipe.  The semantics for that value are the same as for the
> wait(2) system call.  The exit code for a process which exits
> of its own free will is stored in the top 8 bits of the 16-bit
> return code.
> 
> In other words, see the man page for wait(2).

And it can be useful to look at the low byte: IIRC it tells you whether
the program exited on a signal, which is often useful information.  For
example you might opt to terminate yourself immediately if the user
interrupted the program you called.

-- 
 /\\\  Mincom | Martin Pool          | martinp at mincom.com
// \\\        | Software Engineer    | Phone: +61 7 3303-3333
\\ ///        | Mincom Limited       | Teneriffe, Brisbane
 \///         | And now a word from our sponsor...

This transmission is for the intended addressee only and is
confidential information. If you have received this
transmission in error, please delete it and notify the
sender. The contents of this E-mail are the opinion of the
writer only and are not endorsed by Mincom Limited unless
expressly stated otherwise.



More information about the Python-list mailing list