aboutsummaryrefslogtreecommitdiff
path: root/compat/mingw.h
diff options
context:
space:
mode:
authorKarsten Blees <blees@dcon.de>2012-03-01 21:53:54 +0100
committerJunio C Hamano <gitster@pobox.com>2014-06-10 13:32:59 -0700
commitfcd428f4a952a19d7553a9447fd4fa3c3584c6e6 (patch)
treece311aa3ae07c65b099535947ca24c58e7cb4985 /compat/mingw.h
parenteac14f8909d986a38d9eab4a7f926af41dd64a4f (diff)
downloadgit-fcd428f4a952a19d7553a9447fd4fa3c3584c6e6.tar.gz
git-fcd428f4a952a19d7553a9447fd4fa3c3584c6e6.tar.xz
Win32: fix broken pipe detection
As of "Win32: Thread-safe windows console output", git-log no longer terminates when the pager process dies. This is due to disabling buffering for the replaced stdout / stderr streams. Git-log will periodically fflush stdout (see write_or_die.c/mayble_flush_or_die()), but with no buffering, this is a NOP that always succeeds (so we never detect the EPIPE error). Exchange the original console handles with our console thread pipe handles by accessing the internal MSVCRT data structures directly (which are exposed via __pioinfo for some reason). Implement this with minimal assumptions about the actual data structure to make it work with different (hopefully even future) MSVCRT versions. While messing with internal data structures is ugly, this patch solves the problem at the source instead of adding more workarounds. We no longer need the special winansi_isatty override, and the limitations documented in "Win32: Thread-safe windows console output" are gone (i.e. fdopen(1/2) returns unbuffered streams now, and isatty() for duped console file descriptors works as expected). Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Stepan Kasal <kasal@ucw.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.h')
-rw-r--r--compat/mingw.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index 4b638d833..8dac6f9d6 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -318,9 +318,7 @@ int mingw_raise(int sig);
*/
void winansi_init(void);
-int winansi_isatty(int fd);
HANDLE winansi_get_osfhandle(int fd);
-#define isatty winansi_isatty
/*
* git specific compatibility