Move force_coloring_in_ci from builder_helper to bootstrap

It was only used in bootstrap. This move allows us to modify the function to work with `BootstrapCommand`, rather than `Command`.
This commit is contained in:
Jakub Beránek 2024-07-07 17:16:44 +02:00 committed by Jakub Beránek
parent 8cffb475fd
commit ff9c488344
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
4 changed files with 15 additions and 18 deletions

View file

@ -1,5 +1,3 @@
use std::process::Command;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum CiEnv {
/// Not a CI environment.
@ -21,18 +19,6 @@ impl CiEnv {
pub fn is_ci() -> bool {
Self::current() != CiEnv::None
}
/// If in a CI environment, forces the command to run with colors.
pub fn force_coloring_in_ci(self, cmd: &mut Command) {
if self != CiEnv::None {
// Due to use of stamp/docker, the output stream of bootstrap is not
// a TTY in CI, so coloring is by-default turned off.
// The explicit `TERM=xterm` environment is needed for
// `--color always` to actually work. This env var was lost when
// compiling through the Makefile. Very strange.
cmd.env("TERM", "xterm").args(&["--color", "always"]);
}
}
}
pub mod gha {