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>

Johannes Schindelin committed Feb 13, 2017 at 23:34 UTC a4d92d579f792e8eac4f7cf590bfffc522bf3da9
1 file changed +4
compat/winansi.c
+4
@@ -510,6 +510,8 @@ static HANDLE swap_osfhnd(int fd, HANDLE new_handle)
510 */
511 close(new_fd);
512
513 + if (fd == 2)
514 + setvbuf(stderr, NULL, _IONBF, BUFSIZ);
515 fd_is_interactive[fd] |= FD_SWAPPED;
516
517 return duplicate;
@@ -547,6 +549,8 @@ static void detect_msys_tty(int fd)
549 !wcsstr(name, L"-pty"))
550 return;
551
552 + if (fd == 2)
553 + setvbuf(stderr, NULL, _IONBF, BUFSIZ);
554 fd_is_interactive[fd] |= FD_MSYS;
555 }
556