[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] tee: exit early if no more writable outputs
From: |
Bernhard Voelker |
Subject: |
Re: [PATCH 1/2] tee: exit early if no more writable outputs |
Date: |
Tue, 17 Feb 2015 11:42:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 02/17/2015 11:27 AM, Pádraig Brady wrote:
The following patch wrt --write-error, tests the continue
with working outputs functionality. Though that's with pipes
and only with the new option. I've amended the test in this patch
to check continuation with standard files and no options, like:
Thanks. I didn't have a look at the other patch yet.
+ # Ensure we continue with outputs that are OK
+ seq 10000 > multi_read || framework_failure_
+
+ returns_ 1 tee /dev/full 2>err >multi_write <multi_read || fail=1
+ cmp multi_read multi_write || fail=1
Specifying 2 or more output files for tee(1) is probably such an
unusual case - yet mandated by POSIX - that it's likely that we forget
this when making changes in future.
Therefore, I recommend adding this to the test case:
+ returns_ 1 tee out1 /dev/full out2 2>err >multi_write <multi_read || fail=1
+ cmp multi_read out1 || fail=1
+ cmp multi_read out2 || fail=1
+ cmp multi_read multi_write || fail=1
WDYT?
+ # Ensure an error for failing output
+ test $(wc -l < err) = 1 || { cat err; fail=1; }
+
+ returns_ 1 tee multi_write 2>err >/dev/full <multi_read || fail=1
+ cmp multi_read multi_write || fail=1
Likewise.
+ # Ensure an error for failing output
+ test $(wc -l < err) = 1 || { cat err; fail=1; }
Thanks & have a nice day,
Berny