3 ms·
Using "set -e" with pipefail is racy because of SIGPIPE. For example, if you do this: some_command | head Then depending on timing, `some_command` _may_ g
by peff 10y ago
Using "set -e" with pipefail is racy because of SIGPIPE. For example, if you do this:
some_command | head
Then depending on timing, `some_command` _may_ generate all of its output and stuff it into the pipe, exiting successfully. Or `head` may get the lines it needs and close the pipe, causing `some_command` to exit with SIGPIPE. Using pipefail makes the whole pipeline fail, and then `-e` terminates the script.
And it only happens sometimes.
- pixelbeat 10y agoThat really is a bash bug IMHO I've discussed this with upstream bash at http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00052.html http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00052.... I've some general notes on SIGPIPE mishandling at http://www.pixelbeat.org/programming/sigpipe_handling.html http://www.pixelbeat.org/programming/sigpipe_handling.html