Tee and file redirections are very slow to write anything.

Duncan Roe duncan_roe@optusnet.com.au
Wed Feb 24 22:41:49 GMT 2021


On Wed, Feb 24, 2021 at 04:58:24PM -0500, Eliot Moss wrote:
> On 2/24/2021 3:48 PM, ASSI wrote:
> > Hamish McIntyre-Bhatty via Cygwin writes:
> > > I found recently when trying to save output from a script for later
> > > inspection that "tee" and file redirections seem to have massive
> > > delays when run in Cygwin - usually nothing is written to file or
> > > stdout until after the command has finished - not very helpful.
> >
> > You will want to switch from fully buffered to line-buffered or even
> > unbuffered output.
>
> And this does not have to do with Cygwin.  The same happens on Linux.
> The default is that terminal I/O is unbuffered while other stream are
> buffered.  Pipes come under "other streams".  One can make programmatic
> changes to get around this, but most programs won't override the
> default behavior on their own ...
>
> Best -- Eliot Moss

The (Linux) default is that terminal I/O is *line* buffered

The man page for tee doesn't show an option to change buffering, while that for
grep does.

Cheers ... Duncan.


More information about the Cygwin mailing list