bug-coreutils
[Top][All Lists]
Advanced

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

Re: tee logs no output if stdout is closed


From: Bruno Haible
Subject: Re: tee logs no output if stdout is closed
Date: Mon, 30 Jun 2008 12:49:29 +0200
User-agent: KMail/1.5.4

Andreas Schwab wrote:
> > $ rm -f empty; touch empty; rm -f output output2; \
> >   for a in 0 1 2 3 4 5 6 7 8 9 ; do \
> >     for b in 0 1 2 3 4 5 6 7 8 9 ; do \
> >       echo g$a$b | tee -a output; \
> >       echo h$a$b >> output2; \
> >     done; \
> >     sleep 2; \
> >   done \
> >   | { sleep 1; join --nocheck-order -v 2 - empty; }
> >
> > The 'join' command notices that its second argument is empty, stops reading,
> > and exits immediately.
> 
> The tee process then receives a SIGPIPE when trying to write to the
> broken pipe.  That will kill it.

Thanks for explaining.

If 'tee' was to write to the log file(s) first and then only to stdout, and
if the input is small (does not need buffering), then its stdin input would show
up in the output, and this would also be POSIX compliant.

Bruno





reply via email to

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