From 87ecd4f75b0441e986c6cda4cc8a0db07c61ca71 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 31 May 2014 21:55:18 +0200 Subject: [PATCH] libtest: Only colorize output if stdout is a tty Fixes #14570. --- src/libtest/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 {