diff options
| author | Patrick Walton <[email protected]> | 2011-04-28 14:59:16 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-04-28 14:59:16 -0700 |
| commit | 171883f4376740ecf50136717735a5e9ef193b5c (patch) | |
| tree | a30efffa96dc88a870e9e57e9a569020f71097fc /src | |
| parent | stdlib: Add a color_supported() function to Term (diff) | |
| download | rust-171883f4376740ecf50136717735a5e9ef193b5c.tar.xz rust-171883f4376740ecf50136717735a5e9ef193b5c.zip | |
rustc: Only use color if it's supported
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/driver/session.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs index 9dba5e58..501b50b1 100644 --- a/src/comp/driver/session.rs +++ b/src/comp/driver/session.rs @@ -33,9 +33,17 @@ fn emit_diagnostic(span sp, str msg, str kind, u8 color, codemap.codemap cm) { auto hi = codemap.lookup_pos(cm, sp.hi); io.stdout().write_str(#fmt("%s:%u:%u:%u:%u: ", lo.filename, lo.line, lo.col, hi.line, hi.col)); - Term.fg(io.stdout().get_buf_writer(), color); + + if (Term.color_supported()) { + Term.fg(io.stdout().get_buf_writer(), color); + } + io.stdout().write_str(#fmt("%s:", kind)); - Term.reset(io.stdout().get_buf_writer()); + + if (Term.color_supported()) { + Term.reset(io.stdout().get_buf_writer()); + } + io.stdout().write_str(#fmt(" %s\n", msg)); } |