about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-05-31 21:55:18 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2014-05-31 21:55:18 +0200
commit87ecd4f75b0441e986c6cda4cc8a0db07c61ca71 (patch)
treead606f522ac4d111c09d39f6b2b8bef8bd6469cb /src
parentbcf3464827e7caebbbdb2404838fbb588cf304f0 (diff)
downloadrust-87ecd4f75b0441e986c6cda4cc8a0db07c61ca71.tar.gz
rust-87ecd4f75b0441e986c6cda4cc8a0db07c61ca71.zip
libtest: Only colorize output if stdout is a tty
Fixes #14570.
Diffstat (limited to 'src')
-rw-r--r--src/libtest/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index bc69dc442dc..35911949ea4 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -868,7 +868,9 @@ fn should_sort_failures_before_printing_them() {
     assert!(apos < bpos);
 }
 
-fn use_color() -> bool { return get_concurrency() == 1; }
+fn use_color() -> bool {
+    get_concurrency() == 1 && io::stdout().get_ref().isatty()
+}
 
 #[deriving(Clone)]
 enum TestEvent {