olegantonyan / googletest

Automatically exported from code.google.com/p/googletest. Added qmake build
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

color in gnu screen #277

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
GNU screen (http://www.gnu.org/software/screen/) sets TERM to "screen", 
then gtest does not use colors since it does not know "screen".

The following is my patch. I confirmed that it is working.

Index: test/gtest_unittest.cc
===================================================================
--- test/gtest_unittest.cc      (revision 415)
+++ test/gtest_unittest.cc      (working copy)
@@ -6264,6 +6264,9 @@
   SetEnv("TERM", "xterm-color");  // TERM supports colors.
   EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.

+  SetEnv("TERM", "screen");  // TERM supports colors.
+  EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
+
   SetEnv("TERM", "linux");  // TERM supports colors.
   EXPECT_TRUE(ShouldUseColor(true));  // Stdout is a TTY.
 #endif  // GTEST_OS_WINDOWS
Index: src/gtest.cc
===================================================================
--- src/gtest.cc        (revision 415)
+++ src/gtest.cc        (working copy)
@@ -2592,6 +2592,7 @@
         String::CStringEquals(term, "xterm") ||
         String::CStringEquals(term, "xterm-color") ||
         String::CStringEquals(term, "xterm-256color") ||
+        String::CStringEquals(term, "screen") ||
         String::CStringEquals(term, "linux") ||
         String::CStringEquals(term, "cygwin");
     return stdout_is_tty && term_supports_color;

Original issue reported on code.google.com by eun...@gmail.com on 14 Apr 2010 at 7:56

GoogleCodeExporter commented 9 years ago

Original comment by vladlosev on 17 Apr 2010 at 4:55

GoogleCodeExporter commented 9 years ago
This is checked in r421.

Original comment by vladlosev on 22 Apr 2010 at 11:56