Skip to content

Commit b300d91

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge pull request #3751 from rkitover/native-term
mingw: set $env:TERM=xterm-256color for newer OSes
2 parents 3cb30db + e047524 commit b300d91

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

compat/mingw.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,9 +2987,20 @@ static void setup_windows_environment(void)
29872987
convert_slashes(tmp);
29882988
}
29892989

2990-
/* simulate TERM to enable auto-color (see color.c) */
2991-
if (!getenv("TERM"))
2992-
setenv("TERM", "cygwin", 1);
2990+
2991+
/*
2992+
* Make sure TERM is set up correctly to enable auto-color
2993+
* (see color.c .) Use "cygwin" for older OS releases which
2994+
* works correctly with MSYS2 utilities on older consoles.
2995+
*/
2996+
if (!getenv("TERM")) {
2997+
if ((GetVersion() >> 16) < 15063)
2998+
setenv("TERM", "cygwin", 0);
2999+
else {
3000+
setenv("TERM", "xterm-256color", 0);
3001+
setenv("COLORTERM", "truecolor", 0);
3002+
}
3003+
}
29933004

29943005
/* calculate HOME if not set */
29953006
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)