Boost logo

Boost-Build :

Subject: [Boost-build] exit code from SHELL
From: Ray Lambert (codemonkey_at_[hidden])
Date: 2010-07-23 20:56:04


I'm having a minor problem with getting exit codes from SHELL and I'm
hoping someone might know what's happening.

I'm invoking a Python script via the SHELL rule to perform some
pre-build activities. When I run the script manually I get a return
code of either 0 or 1 (as intended):

     $ ./; echo $?

When I run it using SHELL, if the script tries to return 0 SHELL also
returns 0 but when the script tries to return 1 SHELL returns 256 instead:

     local result = [ SHELL "./" : exit-code ] ;
     echo $(result[2]) ;

     (outputs "256").

I wanted to test for " $(result[2]) == 1 " but that obviously fails if I
get 256 back. For now, my work around is " if $(result[2]) != 0 ".

I looked at the bjam source code and found that the exit code is just
the result of pclose(). However, I can't find any return value of 256
defined on my system (Fedora 12).

I looked at the pclose() man page and examined all related pages
(pclose() apparently calls wait4() which apparently calls waitpid()) and
I also scoured the system header files and I can't find any 256 value

Note that when SHELL returns 256 the script does run successfully.

Anyone have any idea where this 256 is coming from or what it means?



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

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at