From 0efae0837a6a6bd1ac5e075c5f1bdc42b80b0f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 9 Oct 2025 10:08:17 +0200 Subject: [PATCH] Show stderr when an `eprintln` profiler invocation fails This allows us to see compiler failures during PGO/BOLT profiling on rustc CI. --- collector/src/bin/rustc-fake.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/collector/src/bin/rustc-fake.rs b/collector/src/bin/rustc-fake.rs index 8cd4621aa..fd506f64f 100644 --- a/collector/src/bin/rustc-fake.rs +++ b/collector/src/bin/rustc-fake.rs @@ -355,11 +355,18 @@ fn main() { "Eprintln" => { let mut cmd = Command::new(tool); + + let file_path = "eprintln"; cmd.args(args).stderr(std::process::Stdio::from( - std::fs::File::create("eprintln").unwrap(), + std::fs::File::create(file_path).unwrap(), )); - run_with_determinism_env(cmd); + determinism_env(&mut cmd); + let status = cmd.status().expect("failed to spawn"); + if !status.success() { + let stderr = std::fs::read_to_string(file_path).unwrap_or_default(); + panic!("command did not complete successfully: {cmd:?}\nstderr:\n{stderr}"); + } } "LlvmLines" => {