]> git.lizzy.rs Git - rust.git/commitdiff
libtest: Only colorize output if stdout is a tty
authorBen Noordhuis <info@bnoordhuis.nl>
Sat, 31 May 2014 19:55:18 +0000 (21:55 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Sat, 31 May 2014 19:55:18 +0000 (21:55 +0200)
Fixes #14570.

src/libtest/lib.rs

index bc69dc442dc654d792cf3780268ef474e1f776cd..35911949ea4424ced8035fe80067bc42f358218a 100644 (file)
@@ -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 {