Re: [PATCH] Unbuffer stdout and stderr on windows

Christopher Faylor
2013-08-15T17:59:47Z

On Thu, Aug 15, 2013 at 08:44:43PM +0300, Eli Zaretskii wrote:
>On Thu, 15 Aug 2013 13:36:18 -0400, Christopher Faylor wrote:
>>I thought that "unbuffered" normally means something like "every output
>>operation gets immediately sent as a block" rather than "flush after
>>every character".
>
>AFAIK, unbuffered always meant the latter.
>
>>If the mingw "unbuffered" mode means that everything is o n e c h a r a
>>c t e r a t a t i m e
>
>It does mean that. Doesn't it work like that in Cygwin?

Cygwin uses newlib which, AFAICT, writes a block at a time without
storing the block in a buffer first.

So:

fwrite (foo, 27, 1, stdout);

writes 27 bytes to stdout in one shot, without buffering.

I only got this from looking at the code so I could be wrong.

>>The other alternative would be to use line buffering for gdb. I don't
>>see why cygwin pipes (whether they are "ptys" or actual pipes) are a
>>special case here. stdout is usually line buffered isn't it? Why not
>>just force that behavior for gdb?
>
>That's what I suggested, but Yao says that using line buffering still
>fails some tests.

Sorry, I missed that you'd already suggested that.

cgf