git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] mingw: make stderr unbuffered again
@ 2017-02-13 22:34 Johannes Schindelin
  2017-02-13 22:39 ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Johannes Schindelin @ 2017-02-13 22:34 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Sixt, Jeff Hostetler

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

 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
-- 
2.11.1.windows.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-02-17 23:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-13 22:34 [PATCH] mingw: make stderr unbuffered again Johannes Schindelin
2017-02-13 22:39 ` Junio C Hamano
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).