about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-01-16 17:29:58 +0000
committerGitHub <noreply@github.com>2021-01-16 17:29:58 +0000
commit5b5aa102b9578bc4034c948609f22fde71cbd8a3 (patch)
tree0832442f72c0dda4b480f03cf87aa0edafde274c
parent5702cfa2551a56172a4e392aab4b494562242f35 (diff)
parent04b60362f8eafdcd62acc2232e9ba0459d5acb5d (diff)
downloadrust-5b5aa102b9578bc4034c948609f22fde71cbd8a3.tar.gz
rust-5b5aa102b9578bc4034c948609f22fde71cbd8a3.zip
Rollup merge of #80901 - jyn514:better-colors, r=Mark-Simulacrum
Make `x.py --color always` apply to logging too

Follow-up to https://github.com/rust-lang/rust/pull/78548, https://github.com/rust-lang/rust/pull/79004.

r? ```@Mark-Simulacrum```
-rw-r--r--src/bootstrap/builder.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index ec9ce4c820c..62065e27dd9 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -814,12 +814,22 @@ impl<'a> Builder<'a> {
             cargo.env("REAL_LIBRARY_PATH", e);
         }
 
+        // Found with `rg "init_env_logger\("`. If anyone uses `init_env_logger`
+        // from out of tree it shouldn't matter, since x.py is only used for
+        // building in-tree.
+        let color_logs = ["RUSTDOC_LOG_COLOR", "RUSTC_LOG_COLOR", "RUST_LOG_COLOR"];
         match self.build.config.color {
             Color::Always => {
                 cargo.arg("--color=always");
+                for log in &color_logs {
+                    cargo.env(log, "always");
+                }
             }
             Color::Never => {
                 cargo.arg("--color=never");
+                for log in &color_logs {
+                    cargo.env(log, "never");
+                }
             }
             Color::Auto => {} // nothing to do
         }