Skip to content

Commit d0e3b42

Browse files
committed
Simplify debugging by printing all env vars, too
1 parent ad42d8b commit d0e3b42

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

cargo-miri/bin.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
mod version;
44

5+
use std::collections::HashMap;
56
use std::env;
67
use std::ffi::{OsStr, OsString};
78
use std::fmt::Write as _;
@@ -882,7 +883,20 @@ fn phase_rustc(mut args: env::Args, phase: RustcPhase) {
882883

883884
// Run it.
884885
if verbose {
885-
eprintln!("[cargo-miri rustc] {:?}", cmd);
886+
eprint!("[cargo-miri rustc] ");
887+
let mut envs = HashMap::new();
888+
for (key, value) in std::env::vars() {
889+
envs.insert(key, value);
890+
}
891+
for (key, value) in cmd.get_envs() {
892+
if let Some(value) = value {
893+
envs.insert(key.to_str().unwrap().into(), value.to_str().unwrap().to_owned());
894+
}
895+
}
896+
for (key, value) in envs {
897+
eprint!("{key}={value:?} ");
898+
}
899+
eprintln!("{:?}", cmd);
886900
}
887901
exec(cmd);
888902

0 commit comments

Comments
 (0)