Skip to content

Commit 0a7f15e

Browse files
committed
Auto merge of #49809 - Mark-Simulacrum:no-color-for-dumb, r=alexcrichton
Stop emitting color codes on TERM=dumb These terminals generally don't support color. Fixes #49191 cc @nikomatsakis r? @alexcrichton
2 parents 67712d7 + d326beb commit 0a7f15e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/bootstrap/compile.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,9 @@ pub fn stream_cargo(
11671167
cargo.arg("--message-format").arg("json")
11681168
.stdout(Stdio::piped());
11691169

1170-
if stderr_isatty() && build.ci_env == CiEnv::None {
1170+
if stderr_isatty() && build.ci_env == CiEnv::None &&
1171+
// if the terminal is reported as dumb, then we don't want to enable color for rustc
1172+
env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
11711173
// since we pass message-format=json to cargo, we need to tell the rustc
11721174
// wrapper to give us colored output if necessary. This is because we
11731175
// only want Cargo's JSON output, not rustcs.

0 commit comments

Comments
 (0)