Skip to content

Commit 7f5527d

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 1e0f176 + 6ecbeaa commit 7f5527d

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
@@ -2989,9 +2989,20 @@ static void setup_windows_environment(void)
29892989
convert_slashes(tmp);
29902990
}
29912991

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

29963007
/* calculate HOME if not set */
29973008
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)