From e3f9b396ab63fde6d17f5cf0647c66521eb232ab Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 4 Mar 2023 17:01:39 -0600 Subject: [PATCH] [Console] Add IS_TTY to force terminal coloring output (#3021) --- common/termcolor/rang.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/termcolor/rang.hpp b/common/termcolor/rang.hpp index 68f830b6f..090c46d80 100644 --- a/common/termcolor/rang.hpp +++ b/common/termcolor/rang.hpp @@ -42,6 +42,8 @@ #include #include +inline bool g_is_forced_tty = std::getenv("IS_TTY"); + namespace rang { /* For better compability with most of terminals do not use any style settings @@ -220,6 +222,10 @@ inline bool isMsysPty(int fd) noexcept inline bool isTerminal(const std::streambuf *osbuf) noexcept { + if (g_is_forced_tty) { + return g_is_forced_tty; + } + using std::cerr; using std::clog; using std::cout;