Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Feb 2018 21:16:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-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-8-hy0VDAbUTQ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-224270-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-224270-8@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

--- Comment #7 from Jilles Tjoelker <jilles@FreeBSD.org> ---
There is a reusable piece of code in a StackOverflow answer
https://unix.stackexchange.com/questions/76162/how-do-i-capture-the-return-=
status-and-use-tee-at-the-same-time-in-korn-shell/76171#76171

This supports simple commands not containing words "|". By defining a funct=
ion
containing the command, any command can be used. It is not the most beautif=
ul
option but it will work and isolate the file descriptor manipulation.

It will not help if you want to set -eo pipefail to make shell "do what I m=
ean"
but I think shell will not do proper error handling automatically with any
option setting anyway.

I already committed a small refactoring in support of -o pipefail to sh whi=
ch
seems good anyway but I'm not entirely sure yet whether to add this feature.

--=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-8-hy0VDAbUTQ>