coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enhancement request for tee - please add the option to not quit on S


From: Pádraig Brady
Subject: Re: Enhancement request for tee - please add the option to not quit on SIGPIPE when someother files are still opened
Date: Fri, 20 Nov 2015 02:20:14 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 20/11/15 01:10, Jirka Hladky wrote:
> Hi Pádraig,
> 
> I was able to find the work-around which is to immediately close tee's stdout 
> output by using /dev/full 
> 
> src/tee --output-error=warn </dev/zero >(head -c100M | wc -c ) >(head -c1 | 
> wc -c ) >/dev/full | src/numfmt --to=iec
> src/tee: standard output: No space left on device
> 1
> src/tee: /dev/fd/62: Broken pipe
> 100M
> src/tee: /dev/fd/63: Broken pipe

Bob's workaround of 1>&- is probably better than >/dev/full
as it only closes stdout for the tee command and is more portable.
Though you still get the warning and error status for EBADF.
Hmm maybe we should always just ignore EBADF for stdout?

> I still thinks that having  --no-stdout option is a better way how to achieve 
> this. Firstly, I'm not sure if /dev/full is available on all supported 
> platforms. It's also not so well known as /dev/null. Furthermore, I don't 
> like the fact that "src/tee: standard output: No space left on device" 
> warning is emitted. It can be misleading for someone reading the log file who 
> is unaware of this work-around. IMHO, it's a workaround how to close the 
> stdout which we don't want tee to create at all in this particular case. And 
> lastly, it could have some negative side-effect (but I could not figure any 
> now).
> 
> Regarding the use-case. Each randomness test returns one p-value. Very low 
> value indicates that RNG has failed the test. You might want all p-values to 
> be in one file or you might be interested into the smallest values only and 
> post-process the output with  sort -n | head . 
> 
> I would still vote to implement --no-stdout option even knowing about 
> >/dev/full workaround. In case I will be outvoted on this one please add at 
> least to tee's man page information that if user do not want tee to write to 
> stdout she/he can close it immediately with >/dev/full trick. 

I'm coming around to making a change here.

Either be quiet about:
  datagen | tee >(sha1sum --tag) >(md5sum --tag) >&- | sort | gpg --clearsign

Or support:
  datagen | tee --no-stdout >(sha1sum --tag) >(md5sum --tag) | sort | gpg 
--clearsign

I like the idea of supporting this with no new option.
I see we have similar EBADF handling in touch and nohup.
I'll sleep on it.

cheers,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]