diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-03-02 20:06:17 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-03-04 13:24:21 +0000 |
commit | 5e9c277f995c517e4403c87e74b758d5b65004f2 (patch) | |
tree | 2ce8a8cfa4224d04c841c6ef21a2938078ab2107 /tests | |
parent | 69410690b8b9838b190c1eaf7d0fa9634e991903 (diff) | |
download | coreutils-5e9c277f995c517e4403c87e74b758d5b65004f2.tar.xz |
tee: generalize the --write-error option to --output-error
Adjust commit v8.23-140-gfdd6ebf to add the --output-error option
instead of --write-error, and treat open() errors like write() errors.
* doc/coreutils.texi (tee invocation): s/write-error/output-error/.
* src/tee.c (main): Exit on open() error if appropriate.
* tests/misc/tee.sh: Add a case to test open() errors.
* NEWS: Adjust for the more general output error behavior.
Suggested by Bernhard Voelker.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/tee.sh | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/misc/tee.sh b/tests/misc/tee.sh index 84665cd00..f457a0b7a 100755 --- a/tests/misc/tee.sh +++ b/tests/misc/tee.sh @@ -64,7 +64,7 @@ if test -w /dev/full && test -c /dev/full; then fi -# Ensure tee honors --write-error modes +# Ensure tee honors --output-error modes mkfifo_or_skip_ fifo read_fifo() { timeout 10 dd count=1 if=fifo of=/dev/null status=none & } @@ -73,30 +73,36 @@ read_fifo yes >fifo pipe_status=$? -# Default operation is to exit silently on SIGPIPE +# Default operation is to continue on output errors but exit silently on SIGPIPE read_fifo -yes | returns_ $pipe_status timeout 10 tee 2>err >fifo || fail=1 -test $(wc -l < err) = 0 || { cat err; fail=1; } +yes | returns_ $pipe_status timeout 10 tee ./e/noent 2>err >fifo || fail=1 +test $(wc -l < err) = 1 || { cat err; fail=1; } # With -p, SIGPIPE is suppressed, exit 0 for EPIPE when all outputs finished read_fifo yes | timeout 10 tee -p 2>err >fifo || fail=1 test $(wc -l < err) = 0 || { cat err; fail=1; } -# With --write-error=warn, exit 1 for EPIPE when all outputs finished +# With --output-error=warn, exit 1 for EPIPE when all outputs finished +read_fifo +yes | returns_ 1 timeout 10 tee --output-error=warn 2>err >fifo || fail=1 +test $(wc -l < err) = 1 || { cat err; fail=1; } + +# With --output-error=exit, exit 1 immediately for EPIPE read_fifo -yes | returns_ 1 timeout 10 tee --write-error=warn 2>err >fifo || fail=1 +yes | returns_ 1 timeout 10 tee --output-error=exit /dev/null 2>err >fifo \ + || fail=1 test $(wc -l < err) = 1 || { cat err; fail=1; } -# With --write-error=exit, exit 1 immediately for EPIPE +# With --output-error=exit, exit 1 immediately on output error read_fifo -yes | returns_ 1 timeout 10 tee --write-error=exit /dev/null 2>err >fifo \ +yes | returns_ 1 timeout 10 tee --output-error=exit ./e/noent 2>err >fifo \ || fail=1 test $(wc -l < err) = 1 || { cat err; fail=1; } -# With --write-error=exit-nopipe, exit 0 for EPIPE +# With --output-error=exit-nopipe, exit 0 for EPIPE read_fifo -yes | timeout 10 tee --write-error=exit-nopipe 2>err >fifo || fail=1 +yes | timeout 10 tee --output-error=exit-nopipe 2>err >fifo || fail=1 test $(wc -l < err) = 0 || { cat err; fail=1; } wait |