Skip to content

Commit e59df62

Browse files
authored
Rollup merge of rust-lang#54323 - Keruspe:rustc-color, r=Mark-Simulacrum
rustbuild: drop color handling Let cargo handle that for us Fixes rust-lang#54322 Needs a beta backport
2 parents e3cc48a + 2a45057 commit e59df62

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

src/bootstrap/bin/rustc.rs

-9
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,6 @@ fn main() {
291291
cmd.arg("-Z").arg("verify-llvm-ir");
292292
}
293293

294-
let color = match env::var("RUSTC_COLOR") {
295-
Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
296-
Err(_) => 0,
297-
};
298-
299-
if color != 0 {
300-
cmd.arg("--color=always");
301-
}
302-
303294
if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
304295
{
305296
cmd.arg("-Dwarnings");

src/bootstrap/compile.rs

+1-33
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use build_helper::{output, mtime, up_to_date};
2929
use filetime::FileTime;
3030
use serde_json;
3131

32-
use util::{exe, libdir, is_dylib, CiEnv};
32+
use util::{exe, libdir, is_dylib};
3333
use {Compiler, Mode, GitRepo};
3434
use native;
3535

@@ -1034,29 +1034,6 @@ pub fn add_to_sysroot(builder: &Builder, sysroot_dst: &Path, stamp: &Path) {
10341034
}
10351035
}
10361036

1037-
// Avoiding a dependency on winapi to keep compile times down
1038-
#[cfg(unix)]
1039-
fn stderr_isatty() -> bool {
1040-
use libc;
1041-
unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
1042-
}
1043-
#[cfg(windows)]
1044-
fn stderr_isatty() -> bool {
1045-
type DWORD = u32;
1046-
type BOOL = i32;
1047-
type HANDLE = *mut u8;
1048-
const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
1049-
extern "system" {
1050-
fn GetStdHandle(which: DWORD) -> HANDLE;
1051-
fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL;
1052-
}
1053-
unsafe {
1054-
let handle = GetStdHandle(STD_ERROR_HANDLE);
1055-
let mut out = 0;
1056-
GetConsoleMode(handle, &mut out) != 0
1057-
}
1058-
}
1059-
10601037
pub fn run_cargo(builder: &Builder,
10611038
cargo: &mut Command,
10621039
tail_args: Vec<String>,
@@ -1218,15 +1195,6 @@ pub fn stream_cargo(
12181195
cargo.arg("--message-format").arg("json")
12191196
.stdout(Stdio::piped());
12201197

1221-
if stderr_isatty() && builder.ci_env == CiEnv::None &&
1222-
// if the terminal is reported as dumb, then we don't want to enable color for rustc
1223-
env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
1224-
// since we pass message-format=json to cargo, we need to tell the rustc
1225-
// wrapper to give us colored output if necessary. This is because we
1226-
// only want Cargo's JSON output, not rustcs.
1227-
cargo.env("RUSTC_COLOR", "1");
1228-
}
1229-
12301198
for arg in tail_args {
12311199
cargo.arg(arg);
12321200
}

0 commit comments

Comments
 (0)