]> git.lizzy.rs Git - rust.git/commitdiff
rustbuild: drop color handling
authorMarc-Antoine Perennou <Marc-Antoine@Perennou.com>
Tue, 18 Sep 2018 12:58:11 +0000 (14:58 +0200)
committerMarc-Antoine Perennou <Marc-Antoine@Perennou.com>
Tue, 18 Sep 2018 13:02:03 +0000 (15:02 +0200)
Let cargo handle that for us

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
src/bootstrap/bin/rustc.rs
src/bootstrap/compile.rs

index f30f34acf5c6c74642ea685e8f6ea1fc0422e1e6..b89976eca26c4b69dbfb13a27fbf919e91a5b257 100644 (file)
@@ -291,15 +291,6 @@ fn main() {
         cmd.arg("-Z").arg("verify-llvm-ir");
     }
 
-    let color = match env::var("RUSTC_COLOR") {
-        Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
-        Err(_) => 0,
-    };
-
-    if color != 0 {
-        cmd.arg("--color=always");
-    }
-
     if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
     {
         cmd.arg("-Dwarnings");
index 4205d5aebffa15dd967672ceaec79bd2c5eba874..608f2c982c2a52485abfd8751054f189a759cf5f 100644 (file)
@@ -29,7 +29,7 @@
 use filetime::FileTime;
 use serde_json;
 
-use util::{exe, libdir, is_dylib, CiEnv};
+use util::{exe, libdir, is_dylib};
 use {Compiler, Mode, GitRepo};
 use native;
 
@@ -1034,29 +1034,6 @@ pub fn add_to_sysroot(builder: &Builder, sysroot_dst: &Path, stamp: &Path) {
     }
 }
 
-// Avoiding a dependency on winapi to keep compile times down
-#[cfg(unix)]
-fn stderr_isatty() -> bool {
-    use libc;
-    unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
-}
-#[cfg(windows)]
-fn stderr_isatty() -> bool {
-    type DWORD = u32;
-    type BOOL = i32;
-    type HANDLE = *mut u8;
-    const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
-    extern "system" {
-        fn GetStdHandle(which: DWORD) -> HANDLE;
-        fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL;
-    }
-    unsafe {
-        let handle = GetStdHandle(STD_ERROR_HANDLE);
-        let mut out = 0;
-        GetConsoleMode(handle, &mut out) != 0
-    }
-}
-
 pub fn run_cargo(builder: &Builder,
                  cargo: &mut Command,
                  tail_args: Vec<String>,
@@ -1218,15 +1195,6 @@ pub fn stream_cargo(
     cargo.arg("--message-format").arg("json")
          .stdout(Stdio::piped());
 
-    if stderr_isatty() && builder.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.
-        cargo.env("RUSTC_COLOR", "1");
-    }
-
     for arg in tail_args {
         cargo.arg(arg);
     }