Skip to content

Commit

Permalink
Apply -Zon-broken-pipe=kill on bin wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyouxu committed Oct 2, 2024
1 parent 2305aad commit e103cd0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ fn main() {
}
_ => Command::new(rustc_driver),
};

cmd.arg("-Zon-broken-pipe=kill");

cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());

if let Some(crate_name) = crate_name {
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/src/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ fn main() {
}
}

cmd.arg("-Zon-broken-pipe=kill");

cmd.args(&args);
cmd.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());

Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,10 +1053,6 @@ pub fn rustc_cargo(

cargo.rustdocflag("-Zcrate-attr=warn(rust_2018_idioms)");

// If the rustc output is piped to e.g. `head -n1` we want the process to be
// killed, rather than having an error bubble up and cause a panic.
cargo.rustflag("-Zon-broken-pipe=kill");

if builder.config.llvm_enzyme {
cargo.rustflag("-l").rustflag("Enzyme-19");
}
Expand Down
7 changes: 0 additions & 7 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ pub fn prepare_tool_cargo(
// See https://github.com/rust-lang/rust/issues/116538
cargo.rustflag("-Zunstable-options");

// `-Zon-broken-pipe=kill` breaks cargo tests
if !path.ends_with("cargo") {
// If the output is piped to e.g. `head -n1` we want the process to be killed,
// rather than having an error bubble up and cause a panic.
cargo.rustflag("-Zon-broken-pipe=kill");
}

cargo
}

Expand Down

0 comments on commit e103cd0

Please sign in to comment.