Skip to content

Commit e103cd0

Browse files
committed
Apply -Zon-broken-pipe=kill on bin wrappers
1 parent 2305aad commit e103cd0

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

src/bootstrap/src/bin/rustc.rs

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ fn main() {
116116
}
117117
_ => Command::new(rustc_driver),
118118
};
119+
120+
cmd.arg("-Zon-broken-pipe=kill");
121+
119122
cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
120123

121124
if let Some(crate_name) = crate_name {

src/bootstrap/src/bin/rustdoc.rs

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ fn main() {
4242
}
4343
}
4444

45+
cmd.arg("-Zon-broken-pipe=kill");
46+
4547
cmd.args(&args);
4648
cmd.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
4749

src/bootstrap/src/core/build_steps/compile.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1053,10 +1053,6 @@ pub fn rustc_cargo(
10531053

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

1056-
// If the rustc output is piped to e.g. `head -n1` we want the process to be
1057-
// killed, rather than having an error bubble up and cause a panic.
1058-
cargo.rustflag("-Zon-broken-pipe=kill");
1059-
10601056
if builder.config.llvm_enzyme {
10611057
cargo.rustflag("-l").rustflag("Enzyme-19");
10621058
}

src/bootstrap/src/core/build_steps/tool.rs

-7
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,6 @@ pub fn prepare_tool_cargo(
209209
// See https://github.com/rust-lang/rust/issues/116538
210210
cargo.rustflag("-Zunstable-options");
211211

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

0 commit comments

Comments
 (0)