Hi Hannes, On Mon, 19 Dec 2016, Johannes Sixt wrote: > Am 18.12.2016 um 16:37 schrieb Johannes Sixt: > > winansi.c is all about overriding MSVCRT's console handling. If we are > > connected to a console, then by the time isatty() is called (from > > outside the emulation layer), all handling of file descriptors 1 and 2 > > is already outside MSVCRT's control. In particular, we have determined > > unambiguously whether a terminal is connected (see is_console()). I > > suggest to have the implementation below (on top of the patch I'm > > responding to). > > > > What do you think? > > I thought a bit more about this approach, and I retract it. I think it > does not work when Git is connected to an MSYS TTY, i.e., when the > "console" is in reality the pipe that is detected in detect_msys_tty(). > > At the same time I wonder how your original winansi_isatty() could have > worked: In this case, MSVCRT's isatty() would return 1 (because > detect_msys_tty() has set things up that this happens), but then > winansi_isatty() checks whether the handle underlying fd 0, 1 or 2 is a real > Windows console. But it is not: it is a pipe. Am I missing something? You did not miss anything. I did. I broke everything. Very sorry for that! Dscho