On 18/11/15 22:50, Jirka Hladky wrote: > Hello tee developers, > > I have recently run into an issue that tee will finish as soon as first pipe > it's writing to is closed. Please consider this example: > > $cat /dev/zero | tee >(head -c1 | wc -c ) >(head -c100M | wc -c ) >/dev/null > 1 > 65536 > > Second wc command will receive only 64kB instead of expected 100MB. > > IMHO, tee should have a command line option to proceed as long some file is > opened. It should be accompanied by another switch which will suppress > writing to STDOUT. > > cat /dev/zero | mytee --skip_stdout_output --continue_on_sigpipe >(head -c1 > | wc -c ) >(head -c100M | wc -c ) > > Expected output: > 1 > 104857600 > > I can implement the changes myself. Please let me know your opinion on that. > BTW, I'm not the first one looking for this feature: > > http://stackoverflow.com/questions/15265228/pipe-to-multiple-files-but-not-stdout > http://unix.stackexchange.com/questions/10623/a-tee-process-is-truncating-its-stdout-when-writing-a-file
Already done in the previous v8.24 release: See the -p option: $ tee >(head -c1 | wc -c >&2) >(head -c1M | wc -c >&2) </dev/zero | head -c10M | wc -c >&2 1 65536 73728 $ tee -p >(head -c1 | wc -c >&2) >(head -c1M | wc -c >&2) </dev/zero | head -c10M | wc -c >&2 1 1048576 10485760 cheers, Pádraig