Skip to content

Commit c53f45d

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 bdee769 + f97e4a3 commit c53f45d

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

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

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

0 commit comments

Comments
 (0)