Dear Maintainer,
Note the following, quoth tee(1):
--output-error[=MODE] set behavior on write error. See MODE below
and
The default MODE for the -p option is 'warn-nopipe'.
The default operation when --output-error is not specified,
is to exit immediately on error writing to a pipe,
and diagnose errors writing to non pipe outputs.
First, the confusing: what does "--output-error", no argument, do?
I haven't managed to ascertain any difference from the default.
The wording leaves much to be desired, I'd thought it was
POSIX handling unless --output-error specified, in which case
exit-pipe,warn-nonpipe. This doesn't appear to be the case.
Second, the wrong: if you care to mime with me, build
-- >8 --
#include <unistd.h>
#include <signal.h>
int main(int argc, char ** argv) {
signal(SIGPIPE, SIG_IGN);
execvp(argv[1], argv+1);
}
-- >8 --
then run
-- >8 --
a$ mkfifo fifo
a$ cat fifo
b$ ./nosigpipe tee fifo
b> a
b< a
a< a
# so far so good
a$ ^C # cat terminated, pipe shut
b> b
b< b
b> c
b< c
# nothing about "fifo", supposedly should've been an instant exit, against POSIX?
b> ^D
b$ echo $?
b< 0
# no diagnostic (nominally fine), but also exit 0 for write error! violates POSIX
-- >8 --
However, consider
-- >8 --
a$ cat fifo
b$ ./nosigpipe tee --output-error=warn fifo
b> a
b< a
a< a
a$ ^C
b> b
b< b
b< tee: fifo: Broken pipe
b> ^D
b$ echo $?
b< 1
-- >8 --
this is slightly more correct.
Best,
наб