[OT] Re: return level?

David Relson relson at osagesoftware.com
Tue Feb 18 19:40:40 CET 2003


At 01:06 PM 2/18/03, Clint Adams wrote:

> > Looks like python is doing a "left shift 8" of the return code and you
> > should do a "right shift 8" to get the value you want.  If I were you, I'd
> > take a look at the documentation of os.system() and see what it's 
> returning.
>
>It's not Python doing the shift; it's the libc system() that does that.
>
>-From /usr/include/bits/waitstatus.h on glibc:
>#define __WEXITSTATUS(status)   (((status) & 0xff00) >> 8)


Clint,

Thanks for chiming in.  I vagueely remembered encountering

Some 6 or 8 years ago, I was programming in Objective-C on NextSTEP.  If I 
remember, something I was doing with fork() or subprocesses() had that same 
"shifted code" result.  I long ago forgot the actual detail, but remembered 
enough to suspect the high-level language and enough to devise the simple 
test that demonstrated what was going on.

Thanks for chiming in - I know know _which_ part of the system does the shift!

David





More information about the Bogofilter mailing list