Boost logo

Boost-Build :

Subject: Re: [Boost-build] exit code from SHELL
From: Ray Lambert (codemonkey_at_[hidden])
Date: 2010-07-24 13:56:17


On 07/24/2010 12:00 PM, Steven Watanabe wrote:
> Ray Lambert wrote:
>> I'm having a minor problem with getting exit codes from SHELL and I'm
>> hoping someone might know what's happening.
>>
...
>
> I'm guessing that the exit code is actually the high byte of
> the result of pclose. (This is a result of the way waitpid encodes
> normal termination vs. termination on a signal). If the script
> returns 2, do you get 512? To get the actual exit code, bjam
> would need to use WIFEXITED/WEXITCODE.

Steven, Looks like you're correct. Returning 2 did indeed result in 512.

So...

I modified bjam to use the macros, like this...

         if ( WIFEXITED(exit_status) )
             exit_status = WEXITSTATUS(exit_status);
         else
             exit_status = -1;

...and that fixed it.

While I was under the covers in bjam I decided to make another small
change to something that's been bothering me. I've added an option
("strip-eol") to builtin_shell() to strip the newlines off of the
output. Problem is though, the new option doesn't make it to
builtin_shell(). I grepped for "exit-status" to see if it had to be
declared somewhere but I can't find it anywhere (except in
builtin_shell()). Any idea what I'm missing?

Thanks,

~ray

PS: I'll submit this as a patch when I'm finished.

-- 
In a world without walls and fences, who needs windows and gates?

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk