Skip to content

Commit 6e7005b

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge pull request #3751 from rkitover/native-term
mingw: set $env:TERM=xterm-256color for newer OSes
2 parents 85ca2f6 + 361230d commit 6e7005b

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
@@ -2898,9 +2898,20 @@ static void setup_windows_environment(void)
28982898
convert_slashes(tmp);
28992899
}
29002900

2901-
/* simulate TERM to enable auto-color (see color.c) */
2902-
if (!getenv("TERM"))
2903-
setenv("TERM", "cygwin", 1);
2901+
2902+
/*
2903+
* Make sure TERM is set up correctly to enable auto-color
2904+
* (see color.c .) Use "cygwin" for older OS releases which
2905+
* works correctly with MSYS2 utilities on older consoles.
2906+
*/
2907+
if (!getenv("TERM")) {
2908+
if ((GetVersion() >> 16) < 15063)
2909+
setenv("TERM", "cygwin", 0);
2910+
else {
2911+
setenv("TERM", "xterm-256color", 0);
2912+
setenv("COLORTERM", "truecolor", 0);
2913+
}
2914+
}
29042915

29052916
/* calculate HOME if not set */
29062917
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)