Re: [PATCH] Unbuffer stdout and stderr on windows

Eli Zaretskii
2013-07-22T15:41:25Z

> From: Yao Qi <yao@codesourcery.com>
> Date: Mon, 22 Jul 2013 11:06:57 +0800
>
> +#ifdef _WIN32
> + /* A Cygwin ssh session may not look like a terminal to the Windows
> + runtime; ensure unbuffered output. */
> + setvbuf (stdout, NULL, _IONBF, BUFSIZ);
> + setvbuf (stderr, NULL, _IONBF, BUFSIZ);
> +#endif

This is wrong, stdout should be line-buffered by default.

Also, this punishes batch mode with stdout redirected to a file: its
stdout buffering (and perhaps also that of stderr, although that's
less important) will now always be line-buffered, i.e. less efficient.

Is it possible to detect the "Cygwin ssh session", whatever that
means, and only do this then? I don't think it's right to change
behavior of a native w32 GDB just because it misbehaves when mixed
with Cygwin. Mixing native and Cygwin programs is asking for trouble
to begin with, so punishing good citizens on behalf of that corner
case is not TRT, IMO.