Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2018 22:39:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 224270] Get exit status of process that's piped to another: set -o pipefail is missing for /bin/sh
Message-ID:  <bug-224270-227-hMEwcfvMPD@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-224270-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-224270-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224270

Alex Richardson <arichardson@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arichardson@FreeBSD.org

--- Comment #8 from Alex Richardson <arichardson@FreeBSD.org> ---
Created attachment 198515
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D198515&action=
=3Dedit
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

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224270-227-hMEwcfvMPD>