aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-04-28 14:59:16 -0700
committerPatrick Walton <[email protected]>2011-04-28 14:59:16 -0700
commit171883f4376740ecf50136717735a5e9ef193b5c (patch)
treea30efffa96dc88a870e9e57e9a569020f71097fc /src
parentstdlib: Add a color_supported() function to Term (diff)
downloadrust-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.rs12
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));
}