[PATCH] D42055: Fallback option for colorized output when terminfo isn't available
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 02:09:23 PST 2018
phosek created this revision.
phosek added a reviewer: chandlerc.
Herald added a subscriber: llvm-commits.
Try to detect the terminal color support by checking the value of the
TERM environment variable. This is not great, but it's better than
nothing when terminfo library isn't available, which may still be the
case on some Linux distributions. This matches the logic used by GCC.
Repository:
rL LLVM
https://reviews.llvm.org/D42055
Files:
lib/Support/Unix/Process.inc
Index: lib/Support/Unix/Process.inc
===================================================================
--- lib/Support/Unix/Process.inc
+++ lib/Support/Unix/Process.inc
@@ -369,6 +369,10 @@
// Return true if we found a color capabilities for the current terminal.
if (HasColors)
return true;
+#else
+ if (const char *TermStr = std::getenv("TERM"))
+ if (strcmp(TermStr, "dumb") != 0)
+ return true;
#endif
// Otherwise, be conservative.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42055.129819.patch
Type: text/x-patch
Size: 464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180115/39c23c8e/attachment.bin>
More information about the llvm-commits
mailing list