Skip to content

Commit 85b7e82

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 fa20ab8 + 892c355 commit 85b7e82

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
@@ -2911,9 +2911,20 @@ static void setup_windows_environment(void)
29112911
convert_slashes(tmp);
29122912
}
29132913

2914-
/* simulate TERM to enable auto-color (see color.c) */
2915-
if (!getenv("TERM"))
2916-
setenv("TERM", "cygwin", 1);
2914+
2915+
/*
2916+
* Make sure TERM is set up correctly to enable auto-color
2917+
* (see color.c .) Use "cygwin" for older OS releases which
2918+
* works correctly with MSYS2 utilities on older consoles.
2919+
*/
2920+
if (!getenv("TERM")) {
2921+
if ((GetVersion() >> 16) < 15063)
2922+
setenv("TERM", "cygwin", 0);
2923+
else {
2924+
setenv("TERM", "xterm-256color", 0);
2925+
setenv("COLORTERM", "truecolor", 0);
2926+
}
2927+
}
29172928

29182929
/* calculate HOME if not set */
29192930
if (!getenv("HOME")) {

0 commit comments

Comments
 (0)