coreutils
[Top][All Lists]
Advanced

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

Re: tee: use unbuffered stdout


From: Pádraig Brady
Subject: Re: tee: use unbuffered stdout
Date: Fri, 23 Nov 2018 13:00:03 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 23/11/18 06:54, Ντέντος Σταύρος wrote:
> Hello there,
> 
> I have tried to both store command output to a file and show it on the
> terminal; hence I used `tee`.
> However, I noticed that `tee` does heavy input buffering for my liking
> (even on several `\n`).
> 
> What is worse is, the program I use does provide output without a
> trailing `\n`, and, for the sake of this example,
> "it is highly important" that I can see also partial output.
> 
> If I run the command unpiped to `tee`, then it works fine.
> 
> I searched online, however neither `stdbuf` nor `unbuffer` (from
> `expect`) are able to help with the case.
> 
> Would it be easy enough to add a `--no-buffering` flag to `tee` instead?
> Or, is there something else I missed from the internet for such operation?

Well tee is implicitly unbuffered.
I'm guessing the issue is with the default buffering mode
changing of the thing writing through the pipe.
I.E. if you replaced tee with cat you'd see the same thing.
Can you try using stdbuf on the filter before the tee, i.e.:

  stdbuf -oL blah | tee blah

cheers,
Pádraig



reply via email to

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