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):
$ ./prebuild.py; 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 "./prebuild.py" : exit-code ] ;
echo $(result) ;
I wanted to test for " $(result) == 1 " but that obviously fails if I
get 256 back. For now, my work around is " if $(result) != 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 acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk