[Lldb-commits] [lldb] r341746 - Check if a terminal supports colors on Windows properly

David Bolvansky via lldb-commits lldb-commits at lists.llvm.org
Sat Sep 8 00:15:56 PDT 2018


Author: xbolva00
Date: Sat Sep  8 00:15:56 2018
New Revision: 341746

URL: http://llvm.org/viewvc/llvm-project?rev=341746&view=rev
Log:
Check if a terminal supports colors on Windows properly

Summary:
Previously we SetUseColor(true) wrongly when output was not a terminal so it broken some (not public) bots.

Thanks for issue report, @stella.stamenova

Reviewers: stella.stamenova, zturner

Reviewed By: stella.stamenova

Subscribers: abidh, lldb-commits, stella.stamenova

Differential Revision: https://reviews.llvm.org/D51772

Modified:
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Host/common/File.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=341746&r1=341745&r2=341746&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Sat Sep  8 00:15:56 2018
@@ -812,7 +812,6 @@ Debugger::Debugger(lldb::LogOutputCallba
   // Enabling use of ANSI color codes because LLDB is using them to highlight
   // text.
   llvm::sys::Process::UseANSIEscapeCodes(true);
-  SetUseColor(true);
 #endif
 }
 

Modified: lldb/trunk/source/Host/common/File.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=341746&r1=341745&r2=341746&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Sat Sep  8 00:15:56 2018
@@ -806,6 +806,9 @@ void File::CalculateInteractiveAndTermin
     if (_isatty(fd)) {
       m_is_interactive = eLazyBoolYes;
       m_is_real_terminal = eLazyBoolYes;
+#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+      m_supports_colors = eLazyBoolYes;
+#endif
     }
 #else
     if (isatty(fd)) {




More information about the lldb-commits mailing list