Handle env vars in debug printing

This commit is contained in:
Brian Carroll 2024-02-06 08:04:00 +00:00
parent 26fdbaf4cd
commit 0f19ecbb86
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0

View file

@ -1436,8 +1436,22 @@ fn run_build_command(mut command: Command, file_to_build: &str, flaky_fail_count
}
}
/// Stringify a command for printing
/// e.g. `HOME=~ zig build-exe foo.zig -o foo`
fn stringify_command(cmd: &Command) -> String {
let mut command_string = std::ffi::OsString::new();
for (name, opt_val) in cmd.get_envs() {
command_string.push(name);
command_string.push("=");
if let Some(val) = opt_val {
command_string.push(val);
} else {
command_string.push("''");
}
command_string.push(" ");
}
command_string.push(cmd.get_program());
for arg in cmd.get_args() {