The code in winansi.c emulates ANSI escape sequences when Git is connected to the "real" windows console, CMD.exe. The details are outline in eac14f8909d9 (Win32: Thread-safe windows console output, 2012-01-14). Essentially, it plugs a pipe between C code and the actual console output handle. This commit also added an override for isatty(), but it was made unnecessary by fcd428f4a952 (Win32: fix broken pipe detection, 2012-03-01). The new isatty() override implemented by cbb3f3c9b197 (mingw: intercept isatty() to handle /dev/null as Git expects it, 2016-12-11) does not take into account that _get_osfhandle() returns the handle visible by the C code, which is the pipe. But it actually wants to investigate the properties of the handle that is actually connected to the outside world. Fortunately, there is already winansi_get_osfhandle(), which returns exactly this handle. Use it. Signed-off-by: Johannes Sixt <j6t@xxxxxxxx> --- I was able to test the idea earlier than anticipated and it does work for me. compat/winansi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/winansi.c b/compat/winansi.c index cb725fb02f..ba360be69b 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -586,7 +586,7 @@ int winansi_isatty(int fd) * * https://msdn.microsoft.com/en-us/library/f4s0ddew.aspx */ - HANDLE handle = (HANDLE)_get_osfhandle(fd); + HANDLE handle = winansi_get_osfhandle(fd); if (fd == STDIN_FILENO) { DWORD dummy; -- 2.11.0.79.gf6b77ca