[Bug 224270] Get exit status of process that's piped to another: set -o pipefail is missing for /bin/sh
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Oct 23 22:39:24 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224270
Alex Richardson <arichardson at FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arichardson at FreeBSD.org
--- Comment #8 from Alex Richardson <arichardson at FreeBSD.org> ---
Created attachment 198515
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=198515&action=edit
possible patch
I would be very interested in having this feature. I just hacked up a quick
patch that seems to work. However, I have never looked at the bin/sh code
before so I probably missed something.
I could upload this to phabricator if it makes sense.
$ ./bin/sh -c "set -o pipefail; yes | head -n1 | wc -l"; echo $?
1
141
$ bash -c "set -o pipefail; yes | head -n1 | wc -l"; echo $?
1
141
$ ./bin/sh -c "set -o pipefail; false | true"; echo $?
1
$ bash -c "set -o pipefail; false | true"; echo $?
1
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list