diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 513a8878..81409a33 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3245,18 +3245,15 @@ bool ShouldUseColor(bool stdout_is_tty) { #else // On non-Windows platforms, we rely on the TERM variable. const char* const term = posix::GetEnv("TERM"); - const bool term_supports_color = + const bool term_supports_color = term != nullptr && ( String::CStringEquals(term, "xterm") || String::CStringEquals(term, "xterm-color") || - String::CStringEquals(term, "xterm-256color") || String::CStringEquals(term, "screen") || - String::CStringEquals(term, "screen-256color") || String::CStringEquals(term, "tmux") || - String::CStringEquals(term, "tmux-256color") || String::CStringEquals(term, "rxvt-unicode") || - String::CStringEquals(term, "rxvt-unicode-256color") || String::CStringEquals(term, "linux") || - String::CStringEquals(term, "cygwin"); + String::CStringEquals(term, "cygwin") || + String::EndsWithCaseInsensitive(term, "-256color")); return stdout_is_tty && term_supports_color; #endif // GTEST_OS_WINDOWS }