]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #49809 - Mark-Simulacrum:no-color-for-dumb, r=alexcrichton
authorkennytm <kennytm@gmail.com>
Wed, 11 Apr 2018 11:56:48 +0000 (19:56 +0800)
committerGitHub <noreply@github.com>
Wed, 11 Apr 2018 11:56:48 +0000 (19:56 +0800)
Stop emitting color codes on TERM=dumb

These terminals generally don't support color.

Fixes #49191

cc @nikomatsakis

r? @alexcrichton

src/bootstrap/compile.rs

index 9cc18464fea094668f1c716c74cffe340e233827..b411b19bd53d21047bd4f93956195070b1e9779c 100644 (file)
@@ -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.