Skip to content

Commit 4807d25

Browse files
committed
Print environment variables for cargo run in extra verbose mode
1 parent f137594 commit 4807d25

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/cargo/ops/cargo_run.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ pub fn run(
100100
// by `compile.target_process` (the package's root directory)
101101
process.args(args).cwd(config.cwd());
102102

103+
if config.extra_verbose() {
104+
process.display_env_vars();
105+
}
106+
103107
config.shell().status("Running", process.to_string())?;
104108

105109
process.exec_replace()

tests/testsuite/run.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,23 @@ fn default_run_workspace() {
14161416
p.cargo("run").with_stdout("run-a").run();
14171417
}
14181418

1419+
#[cargo_test]
1420+
fn print_env_verbose() {
1421+
let p = project()
1422+
.file(
1423+
"Cargo.toml",
1424+
r#"
1425+
[package]
1426+
name = "a"
1427+
version = "0.0.1"
1428+
"#,
1429+
)
1430+
.file("src/main.rs", r#"fn main() {println!("run-a");}"#)
1431+
.build();
1432+
1433+
p.cargo("run -vv").with_stderr("LD_LIBRARY_PATH").run();
1434+
}
1435+
14191436
#[cargo_test]
14201437
#[cfg(target_os = "macos")]
14211438
fn run_link_system_path_macos() {

0 commit comments

Comments
 (0)