Files
git/compat
Johannes Schindelin de0d35dbab mingw: Work around MSVCRT's isatty() not knowing about MSys2
MSys2 has a slightly different notion of what constitutes a tty than
the Microsoft C runtime. The former knows whether stdin/stdout/stderr
was redirected or not, while the latter looks for a Win32 Console.

In particular when we want to know whether to spawn a pager or not, we
would rather want to know what MSys2 thinks.

We are about to introduce a change to the msys2-runtime that sets an
environment variable MSYS_TTY_HANDLES to a list of Win32 handles that
correspond to stdin/stdout/stderr, respectively, *but skips* handles that
MSys2 does not think are terminals.

This commit handles that input to augment the isatty() function to return
1 also when MSYS_TTY_HANDLES contains the corresponding handle.

The only time when Git needs to know whether a Console is attached or not
is when winansi.c is asked to Do Its Thing, therefore we refrain from
overriding isatty there.

Note: this was an issue with MSys1-based Git for Windows, too, hidden by
the fact that Git for Windows used `cmd.exe` as a terminal -- which is
backed by a real Win32 Console. Had MSys1 used, say, rxvt as its default
terminal, the symptom would have been that "git log" does not spawn a
pager by default but instead outputs the entire history (without color
coding, too). In MSys2, the default terminal is mintty, therefore we
finally could not avoid to address the issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-03-10 14:59:06 +01:00
..
2014-06-03 12:06:40 -07:00
2010-11-23 16:06:50 -08:00
2013-09-11 11:08:52 -07:00
2011-09-11 14:43:33 -07:00
2013-04-12 12:23:20 -07:00