diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-08-18 12:35:20 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-08-18 12:35:20 +0200 |
| commit | 4668751e522171185eea69f2bdfba18b7ffb5f5c (patch) | |
| tree | f6feaa1216878749bf67d241f1ad7ada70fd1109 | |
| parent | 425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0 (diff) | |
| download | rust-4668751e522171185eea69f2bdfba18b7ffb5f5c.tar.gz rust-4668751e522171185eea69f2bdfba18b7ffb5f5c.zip | |
Print what bootstrap invocation failed when an error happens in CI
| -rw-r--r-- | src/build_helper/src/util.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/build_helper/src/util.rs b/src/build_helper/src/util.rs index a8355f774e9..1bdbb7515e2 100644 --- a/src/build_helper/src/util.rs +++ b/src/build_helper/src/util.rs @@ -3,6 +3,8 @@ use std::io::{BufRead, BufReader}; use std::path::Path; use std::process::Command; +use crate::ci::CiEnv; + /// Invokes `build_helper::util::detail_exit` with `cfg!(test)` /// /// This is a macro instead of a function so that it uses `cfg(test)` in the *calling* crate, not in build helper. @@ -20,6 +22,15 @@ pub fn detail_exit(code: i32, is_test: bool) -> ! { if is_test { panic!("status code: {code}"); } else { + // If we're in CI, print the current bootstrap invocation command, to make it easier to + // figure out what exactly has failed. + if CiEnv::is_ci() { + // Skip the first argument, as it will be some absolute path to the bootstrap binary. + let bootstrap_args = + std::env::args().skip(1).map(|a| a.to_string()).collect::<Vec<_>>().join(" "); + eprintln!("Bootstrap failed while executing `{bootstrap_args}`"); + } + // otherwise, exit with provided status code std::process::exit(code); } |
