This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Unbuffer stdout and stderr on windows
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 22 Jul 2013 18:40:37 +0300
- Subject: Re: [PATCH] Unbuffer stdout and stderr on windows
- References: <1374462417-7961-1-git-send-email-yao at codesourcery dot com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> 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.