Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org, Johannes Sixt <j6t@kdbg.org>,
	Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH] mingw: make stderr unbuffered again
Date: Mon, 13 Feb 2017 14:39:00 -0800	[thread overview]
Message-ID: <xmqqlgt9btrv.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <c88612da0a62bfcbc3e278296f9d3eb010057071.1487025228.git.johannes.schindelin@gmx.de> (Johannes Schindelin's message of "Mon, 13 Feb 2017 23:34:06 +0100 (CET)")

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> When removing the hack for isatty(), we actually removed more than just
> an isatty() hack: we removed the hack where internal data structures of
> the MSVC runtime are modified in order to redirect stdout/stderr.
>
> Instead of using that hack (that does not work with newer versions of
> the runtime, anyway), we replaced it by reopening the respective file
> descriptors.
>
> What we forgot was to mark stderr as unbuffered again.
>
> Reported by Hannes Sixt. Fixed with Jeff Hostetler's assistance.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> Published-As: https://github.com/dscho/git/releases/tag/mingw-unbuffered-stderr-v1
> Fetch-It-Via: git fetch https://github.com/dscho/git mingw-unbuffered-stderr-v1

OK.  Should this go directly to 'master', as the isatty thing is
already in?

>
>  compat/winansi.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/compat/winansi.c b/compat/winansi.c
> index 82b89ab1376..793420f9d0d 100644
> --- a/compat/winansi.c
> +++ b/compat/winansi.c
> @@ -510,6 +510,8 @@ static HANDLE swap_osfhnd(int fd, HANDLE new_handle)
>  	 */
>  	close(new_fd);
>  
> +	if (fd == 2)
> +		setvbuf(stderr, NULL, _IONBF, BUFSIZ);
>  	fd_is_interactive[fd] |= FD_SWAPPED;
>  
>  	return duplicate;
> @@ -547,6 +549,8 @@ static void detect_msys_tty(int fd)
>  			!wcsstr(name, L"-pty"))
>  		return;
>  
> +	if (fd == 2)
> +		setvbuf(stderr, NULL, _IONBF, BUFSIZ);
>  	fd_is_interactive[fd] |= FD_MSYS;
>  }
>  
>
> base-commit: 5588dbffbd61e4906e453808c6ad32f792fea521

  reply	other threads:[~2017-02-13 22:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 22:34 [PATCH] mingw: make stderr unbuffered again Johannes Schindelin
2017-02-13 22:39 ` Junio C Hamano [this message]
2017-02-14 14:47   ` Johannes Schindelin
2017-02-14 18:45     ` Johannes Sixt
2017-02-14 18:58       ` Junio C Hamano
2017-02-15 12:32       ` Johannes Schindelin
2017-02-15 20:45         ` Johannes Sixt
2017-02-16 17:10           ` Johannes Schindelin
2017-02-16 17:55             ` Johannes Sixt
2017-02-16 18:01               ` Junio C Hamano
2017-02-14 18:48     ` Junio C Hamano
2017-02-15 12:48       ` Johannes Schindelin
2017-02-15 22:22         ` Junio C Hamano
2017-02-15 23:34           ` Junio C Hamano
2017-02-17 16:00             ` Johannes Schindelin
2017-02-17 23:49               ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqlgt9btrv.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=jeffhost@microsoft.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox