diff options
| author | Damian Gryski <damian@gryski.com> | 2012-07-26 23:50:20 +0200 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-07-26 17:05:13 -0700 |
| commit | ffb067640b7701da8a7cdecb610ff737262c141c (patch) | |
| tree | f9a095c5b9285defa531f09bcd7dbb75199c75ea /src/libsyntax | |
| parent | cdd052f6ea1fb268a25e467147643344ec9a6b8c (diff) | |
| download | rust-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.rs | 6 |
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]); |
