about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-04-11 19:56:48 +0800
committerGitHub <noreply@github.com>2018-04-11 19:56:48 +0800
commit4dbca4c8ac713bb4cf13a4460b4f98751fce2191 (patch)
treecad44f7c9ba64e0aae735ecdf6f3573b252906d8 /src/bootstrap
parent6eb66fc315065cd92c940d5c1c12d79ebb3d7cd8 (diff)
parentd326bebf919a84e1b130efb517deb7d0848603e3 (diff)
downloadrust-4dbca4c8ac713bb4cf13a4460b4f98751fce2191.tar.gz
rust-4dbca4c8ac713bb4cf13a4460b4f98751fce2191.zip
Rollup 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
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/compile.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 9cc18464fea..b411b19bd53 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -1167,7 +1167,9 @@ pub fn stream_cargo(
     cargo.arg("--message-format").arg("json")
          .stdout(Stdio::piped());
 
-    if stderr_isatty() && build.ci_env == CiEnv::None {
+    if stderr_isatty() && build.ci_env == CiEnv::None &&
+        // if the terminal is reported as dumb, then we don't want to enable color for rustc
+        env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
         // since we pass message-format=json to cargo, we need to tell the rustc
         // wrapper to give us colored output if necessary. This is because we
         // only want Cargo's JSON output, not rustcs.