freebsd-dev/bin/sh/tests
Jilles Tjoelker 484160a9cf sh: Add set -o pipefail
The pipefail option allows checking the exit status of all commands in a
pipeline more easily, at a limited cost of complexity in sh itself. It works
similarly to the option in bash, ksh93 and mksh.

Like ksh93 and unlike bash and mksh, the state of the option is saved when a
pipeline is started. Therefore, even in the case of commands like
  A | B &
a later change of the option does not change the exit status, the same way
  (A | B) &
works.

Since SIGPIPE is not handled specially, more work in the script is required
for a proper exit status for pipelines containing commands such as head that
may terminate successfully without reading all input. This can be something
like

(
        cmd1
        r=$?
        if [ "$r" -gt 128 ] && [ "$(kill -l "$r")" = PIPE ]; then
                exit 0
        else
                exit "$r"
        fi
) | head

PR:		224270
Relnotes:	yes
2019-02-24 21:05:13 +00:00
..
builtins sh: Don't treat % specially in CDPATH 2018-07-15 21:55:17 +00:00
errors sh: Use 126 and 127 exit status for failures opening a script 2018-11-27 21:49:59 +00:00
execution sh: Add set -o pipefail 2019-02-24 21:05:13 +00:00
expansion sh: Restore $((x)) error checking after fix for $((-9223372036854775808)) 2019-02-10 22:23:05 +00:00
invocation DIRDEPS_BUILD: Connect new directories. 2017-10-31 00:04:07 +00:00
parameters sh: Do not import IFS's value from the environment. 2016-10-08 13:40:12 +00:00
parser sh: Test that backslash-newline within single-quotes is not special 2018-05-11 21:56:01 +00:00
set-e Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
functional_test.sh sh: Don't hardcode relative paths in the tests stderr files. 2014-08-17 14:26:12 +00:00
Makefile sh: Add tests for sh -c that already pass. 2017-08-12 19:17:48 +00:00
Makefile.depend DIRDEPS_BUILD: Connect MK_TESTS. 2016-03-09 22:46:01 +00:00