Skip to content

Commit 7ec95c0

Browse files
authored
Merge pull request #2274 from Kobzol/eprintln-stderr
Show stderr when an `eprintln` profiler invocation fails
2 parents f602dbb + 0efae08 commit 7ec95c0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

collector/src/bin/rustc-fake.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,18 @@ fn main() {
355355

356356
"Eprintln" => {
357357
let mut cmd = Command::new(tool);
358+
359+
let file_path = "eprintln";
358360
cmd.args(args).stderr(std::process::Stdio::from(
359-
std::fs::File::create("eprintln").unwrap(),
361+
std::fs::File::create(file_path).unwrap(),
360362
));
361363

362-
run_with_determinism_env(cmd);
364+
determinism_env(&mut cmd);
365+
let status = cmd.status().expect("failed to spawn");
366+
if !status.success() {
367+
let stderr = std::fs::read_to_string(file_path).unwrap_or_default();
368+
panic!("command did not complete successfully: {cmd:?}\nstderr:\n{stderr}");
369+
}
363370
}
364371

365372
"LlvmLines" => {

0 commit comments

Comments
 (0)