From 234348ebeec2a3f32148a1ddfe71aefa54ef6bd1 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 20 Jun 2018 13:50:14 +0200 Subject: [PATCH] log_msg: do not use colors in MSYS2 terminal MSYS2 pseudoterminal doesn't handle MSW terminal colors, it uses POSIX colors instead. --- src/debug.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/debug.cpp b/src/debug.cpp index 0e909b564..817ad1b8c 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -158,7 +158,8 @@ void log_msg(int level, const char *format, ...) #ifdef WIN32 if (color_win != 0u) { con = GetStdHandle(STD_ERROR_HANDLE); - no_color = con == INVALID_HANDLE_VALUE || getenv("NO_COLOR"); + no_color = con == INVALID_HANDLE_VALUE || getenv("NO_COLOR") + || (getenv("TERM") && strcmp(getenv("TERM"), "xterm") == 0); // MSYS2 pseudoterminal if (!no_color) { GetConsoleScreenBufferInfo(con, &con_info); SetConsoleTextAttribute(con, ((con_info.wAttributes) & 0xF0) | color_win);