Opened 12 years ago

Closed 12 years ago

#4470 closed Patches (fixed)

SHELL: fix exit-code and add 'strip-eol' option

Reported by: codemonkey@… Owned by: René Rivera
Milestone: To Be Determined Component: bjam
Version: Boost.Jam 3.1.18 Severity: Problem
Keywords: Cc:

Description

This patch applies WIFEXITED() and WEXITSTATUS() to the exit code returned by the SHELL rule when the 'exit-code' option is used.

Without these (on Linux, at least) the exit code is left-shifted 8 bits so that an actual exit code of 1 shows up as 256 and an actual exit code of 2 shows up as 512 (etc).

This patch also adds a new 'strip-eol' option to the SHELL rule. This causes trailing white space (most importantly, newlines) on the command's output to be removed before it's returned to the caller. Note that embedded newlines are left intact; these are needed if the user wants to echo the output and it contains multiple lines.

Note that 'strip-eol' has no practical effect if 'no-output' is also used.

Usage example:

local foo = [ SHELL "./foo.sh" : exit-code : strip-eol ] ;

Attachments (2)

shell.patch (1.6 KB ) - added by codemonkey@… 12 years ago.
shell.2.patch (1.6 KB ) - added by codemonkey@… 12 years ago.
updated patch against bjam version 3.1.18

Download all attachments as: .zip

Change History (7)

by codemonkey@…, 12 years ago

Attachment: shell.patch added

comment:1 by anonymous, 12 years ago

Version: Boost.Jam 3.1.17Boost.Jam 3.1.16

by codemonkey@…, 12 years ago

Attachment: shell.2.patch added

updated patch against bjam version 3.1.18

comment:2 by anonymous, 12 years ago

Version: Boost.Jam 3.1.16Boost.Jam 3.1.18

comment:3 by codemonkey@…, 12 years ago

Note: The original patch is against bjam version 3.1.16 . (I originally thought it was against 3.1.17 before realizing my error.)

The new patch is against the current version, 3.1.18.

comment:4 by Vladimir Prus, 12 years ago

Thanks. I've applied this patch.

comment:5 by Vladimir Prus, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.