aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-02-13 23:34:06 +0100
committerJunio C Hamano <gitster@pobox.com>2017-02-14 10:54:21 -0800
commita4d92d579f792e8eac4f7cf590bfffc522bf3da9 (patch)
treeaa46ad1d8065d65c3d678ffeabd33e3158e841e0
parent1d3f065e0e4090a78640642cc1c1a3ce91d7852a (diff)
downloadgit-a4d92d579f792e8eac4f7cf590bfffc522bf3da9.tar.gz
git-a4d92d579f792e8eac4f7cf590bfffc522bf3da9.tar.xz
mingw: make stderr unbuffered again
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> Tested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--compat/winansi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compat/winansi.c b/compat/winansi.c
index 56658ec4f..dac5d01c5 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;
}