Stdio buffering question
Doug Gwyn
gwyn at brl-smoke.ARPA
Sat Jun 11 19:56:53 AEST 1988
In article <4999 at super.upenn.edu> david at linc.cis.upenn.edu.UUCP (David Feldman) writes:
>Well, I can give an answer based on Ultrix experience. When piping,
>stderr gets buffered so that it may be separated from stdout. Stdout
>goes through the pipe, and when it is closed, the stderr buffer gets flushed
>through the pipe. That is assuming you have redirected stderr through the
>pipe also. This is a documented feature, and I believe it is a csh thing.
What the hell are you talking about? The whole reason for the invention
of the standard error output as distinct from standard output is to AVOID
error output getting mixed with legitimate output in pipelines etc.
I don't like csh, but I won't accuse it of directing standard error output
into pipes. Indeed I think you'd have to work fairly hard to get it to
do so.
My guess for the reason that stderr is (line-)buffered on some BSD-derived
systems is that Bill Shannon once thought it would be a good idea and just
did it. (Apologies if I'm maligning him.) It is also possible that
someone thought it would improve network performance for error output to
be sent in large chunks rather than a character at a time.
More information about the Comp.unix.wizards
mailing list