summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorDamian Gryski <damian@gryski.com>2012-07-26 23:50:20 +0200
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-07-26 17:05:13 -0700
commitffb067640b7701da8a7cdecb610ff737262c141c (patch)
treef9a095c5b9285defa531f09bcd7dbb75199c75ea /src/libsyntax
parentcdd052f6ea1fb268a25e467147643344ec9a6b8c (diff)
downloadrust-ffb067640b7701da8a7cdecb610ff737262c141c.tar.gz
rust-ffb067640b7701da8a7cdecb610ff737262c141c.zip
diagnostic: only print color if output is for the screen
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index cda49de8dd0..6178dfb616e 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -163,14 +163,16 @@ fn diagnosticcolor(lvl: level) -> u8 {
 }
 
 fn print_diagnostic(topic: ~str, lvl: level, msg: ~str) {
+    let use_color = term::color_supported() &&
+        io::stderr().get_type() == io::screen;
     if str::is_not_empty(topic) {
         io::stderr().write_str(#fmt["%s ", topic]);
     }
-    if term::color_supported() {
+    if use_color {
         term::fg(io::stderr(), diagnosticcolor(lvl));
     }
     io::stderr().write_str(#fmt["%s:", diagnosticstr(lvl)]);
-    if term::color_supported() {
+    if use_color {
         term::reset(io::stderr());
     }
     io::stderr().write_str(#fmt[" %s\n", msg]);