File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed
Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ use std::env;
22use std:: ffi:: { OsStr , OsString } ;
33use std:: path:: { Path , PathBuf } ;
44
5+ use build_helper:: ci:: CiEnv ;
6+
57use super :: { Builder , Kind } ;
68use crate :: core:: build_steps:: test;
79use crate :: core:: build_steps:: tool:: SourceType ;
@@ -1334,7 +1336,13 @@ impl Builder<'_> {
13341336 // Try to use a sysroot-relative bindir, in case it was configured absolutely.
13351337 cargo. env ( "RUSTC_INSTALL_BINDIR" , self . config . bindir_relative ( ) ) ;
13361338
1337- cargo. force_coloring_in_ci ( ) ;
1339+ if CiEnv :: is_ci ( ) {
1340+ // Tell cargo to use colored output for nicer logs in CI, even
1341+ // though CI isn't printing to a terminal.
1342+ // Also set an explicit `TERM=xterm` so that cargo doesn't warn
1343+ // about TERM not being set.
1344+ cargo. env ( "TERM" , "xterm" ) . args ( [ "--color=always" ] ) ;
1345+ } ;
13381346
13391347 // When we build Rust dylibs they're all intended for intermediate
13401348 // usage, so make sure we pass the -Cprefer-dynamic flag instead of
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ use std::process::{
2121use std:: sync:: { Arc , Mutex } ;
2222use std:: time:: { Duration , Instant } ;
2323
24- use build_helper:: ci:: CiEnv ;
2524use build_helper:: drop_bomb:: DropBomb ;
2625use build_helper:: exit;
2726
@@ -390,18 +389,6 @@ impl<'a> BootstrapCommand {
390389 self . drop_bomb . get_created_location ( )
391390 }
392391
393- /// If in a CI environment, forces the command to run with colors.
394- pub fn force_coloring_in_ci ( & mut self ) {
395- if CiEnv :: is_ci ( ) {
396- // Due to use of stamp/docker, the output stream of bootstrap is not
397- // a TTY in CI, so coloring is by-default turned off.
398- // The explicit `TERM=xterm` environment is needed for
399- // `--color always` to actually work. This env var was lost when
400- // compiling through the Makefile. Very strange.
401- self . env ( "TERM" , "xterm" ) . args ( [ "--color" , "always" ] ) ;
402- }
403- }
404-
405392 pub fn fingerprint ( & self ) -> CommandFingerprint {
406393 let command = & self . command ;
407394 CommandFingerprint {
You can’t perform that action at this time.
0 commit comments