From: Danny S. <dan...@cl...> - 2004-12-20 09:10:40
|
Bas van Gompel wrote: > Op Sun, 19 Dec 2004 20:52:04 +1300 schreef Danny Smith > in <000401c4e59f$a3237ff0$ab4861cb@DANNY>: >> Bas van Gompel wrote: >>> Hallo, >>> >>> Here is a little patch which will cause stderr to not be buffered. >>> (Some people seem to expect it to be that way...) >>> >>> >> stderr is already unbuffered at startup (stderr->_buzsiz = = 0). As I >> understand ANSI std, it std doesn't require the _IONBF flag to be set, >> just that stderr is not fully buffered. > > I don't know. On the cygwin-patches mailinglist people seemed to expect > fflush (stderr) to be a no-op... At the moment it isn't: > If I remove the redirection and just run the exe from command line, I get this, with or without flushing stderr: stdoutstderrstdout What the heck is the OS doing with "tstdio.exe > unflushed 2>&1"? It seems like it is setting up temp buffers (defaulting to full buffering).for redirected stderr and stdout. In that case wouldn't both need to be flushed to reproduce what is normally displayed on console? OK, put checks for isatty in the code and see what happens? Nah, just fflush. Deja vu? >> I think your proposed change will break code that use setbuf() to assign a >> buffer to stderr. > > I tried, and setbuf still works. (The buffer is used.) > Yes I see that now, setbuf sets _IOFBF (if buffer is not NULL) regardless of prior state. Danny > > L8r, > > Buzz. |