Skip to content

Commit 87ecd4f

Browse files
committed
libtest: Only colorize output if stdout is a tty
Fixes #14570.
1 parent bcf3464 commit 87ecd4f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libtest/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,9 @@ fn should_sort_failures_before_printing_them() {
868868
assert!(apos < bpos);
869869
}
870870

871-
fn use_color() -> bool { return get_concurrency() == 1; }
871+
fn use_color() -> bool {
872+
get_concurrency() == 1 && io::stdout().get_ref().isatty()
873+
}
872874

873875
#[deriving(Clone)]
874876
enum TestEvent {

0 commit comments

Comments
 (0)