From 23c887d0a3ffe64810448d77ffd3791ad3a4f29c Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 20 May 2021 13:42:15 +0200 Subject: [PATCH] Debug: allow ANSI colors for MSYS Assume that MSYS is capable of displaying ANSI sequences even if setWinTermAnsiColors fails. --- src/debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 67db92c8e..a2b19fbd0 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -269,8 +269,8 @@ void Logger::preinit(bool skip_repeated) rang::setControlMode(rang::control::Force); #ifdef _WIN32 // ANSI control sequences need to be explicitly set in Windows - if (rang::rang_implementation::setWinTermAnsiColors(std::cout.rdbuf()) && - rang::rang_implementation::setWinTermAnsiColors(std::cerr.rdbuf())) { + if ((rang::rang_implementation::setWinTermAnsiColors(std::cout.rdbuf()) || rang::rang_implementation::isMsysPty(_fileno(stdout))) && + (rang::rang_implementation::setWinTermAnsiColors(std::cerr.rdbuf()) || rang::rang_implementation::isMsysPty(_fileno(stderr)))) { rang::setWinTermMode(rang::winTerm::Ansi); } #endif