File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -20,3 +20,6 @@ regex = "1"
20
20
21
21
[dev-dependencies ]
22
22
expect-test = " 1.0"
23
+
24
+ [target .'cfg(windows)' .dependencies ]
25
+ termcolor = " 1.0"
Original file line number Diff line number Diff line change @@ -298,10 +298,31 @@ fn run_test(
298
298
ErrorOutputType :: HumanReadable ( kind) => {
299
299
let ( _, color_config) = kind. unzip ( ) ;
300
300
match color_config {
301
- ColorConfig :: Never => { }
302
- _ => {
301
+ ColorConfig :: Never => {
302
+ compiler. arg ( "--color" ) . arg ( "never" ) ;
303
+ }
304
+ ColorConfig :: Always => {
303
305
compiler. arg ( "--color" ) . arg ( "always" ) ;
304
306
}
307
+ ColorConfig :: Auto => {
308
+ #[ cfg( windows) ]
309
+ {
310
+ // This specific check is because old windows consoles require a connection
311
+ // to be able to display colors (and they don't support ANSI), which we
312
+ // cannot in here, so in case this is an old windows console, we can't
313
+ // display colors.
314
+ use crate :: termcolor:: { ColorChoice , StandardStream , WriteColor } ;
315
+ if StandardStream :: stdout ( ColorChoice :: Auto ) . is_synchronous ( ) {
316
+ compiler. arg ( "--color" ) . arg ( "never" ) ;
317
+ } else {
318
+ compiler. arg ( "--color" ) . arg ( "always" ) ;
319
+ }
320
+ }
321
+ #[ cfg( not( windows) ) ]
322
+ {
323
+ compiler. arg ( "--color" ) . arg ( "always" ) ;
324
+ }
325
+ }
305
326
}
306
327
}
307
328
_ => { }
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ extern crate rustc_target;
54
54
extern crate rustc_trait_selection;
55
55
extern crate rustc_typeck;
56
56
extern crate test as testing;
57
+ #[ macro_use]
58
+ extern crate tracing;
59
+ #[ cfg( windows) ]
60
+ extern crate termcolor;
57
61
58
62
use std:: default:: Default ;
59
63
use std:: env;
You can’t perform that action at this time.
0 commit comments