Skip to content

Commit 3969125

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 7a81837 + a8d826b commit 3969125

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
@@ -2964,9 +2964,20 @@ static void setup_windows_environment(void)
29642964
convert_slashes(tmp);
29652965
}
29662966

2967-
/* simulate TERM to enable auto-color (see color.c) */
2968-
if (!getenv("TERM"))
2969-
setenv("TERM", "cygwin", 1);
2967+
2968+
/*
2969+
* Make sure TERM is set up correctly to enable auto-color
2970+
* (see color.c .) Use "cygwin" for older OS releases which
2971+
* works correctly with MSYS2 utilities on older consoles.
2972+
*/
2973+
if (!getenv("TERM")) {
2974+
if ((GetVersion() >> 16) < 15063)
2975+
setenv("TERM", "cygwin", 0);
2976+
else {
2977+
setenv("TERM", "xterm-256color", 0);
2978+
setenv("COLORTERM", "truecolor", 0);
2979+
}
2980+
}
29702981

29712982
/* calculate HOME if not set */
29722983
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)