diff options
| author | Ralf Jung <post@ralfj.de> | 2023-08-02 21:20:51 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-08-24 08:08:46 +0200 |
| commit | f2b139f23d574ca1d2c764b581a3b993e9af1570 (patch) | |
| tree | 85d8abb1876ab1690f28e1bb594ba8b83847dbea /library/std/src/process | |
| parent | 95305899b8493a65065ebdeae44e841d243621eb (diff) | |
| download | rust-f2b139f23d574ca1d2c764b581a3b993e9af1570.tar.gz rust-f2b139f23d574ca1d2c764b581a3b993e9af1570.zip | |
Command: also print removed env vars
Diffstat (limited to 'library/std/src/process')
| -rw-r--r-- | library/std/src/process/tests.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index 366b591466c..2c331eb0104 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -452,7 +452,7 @@ fn env_empty() { #[test] #[cfg(not(windows))] #[cfg_attr(any(target_os = "emscripten", target_env = "sgx"), ignore)] -fn main() { +fn debug_print() { const PIDFD: &'static str = if cfg!(target_os = "linux") { " create_pidfd: false,\n" } else { "" }; @@ -541,6 +541,27 @@ fn main() { {PIDFD}}}"# ) ); + + let mut command_with_removed_env = Command::new("boring-name"); + command_with_removed_env.env_remove("BAR"); + assert_eq!(format!("{command_with_removed_env:?}"), r#"unset(BAR) "boring-name""#); + assert_eq!( + format!("{command_with_removed_env:#?}"), + format!( + r#"Command {{ + program: "boring-name", + args: [ + "boring-name", + ], + env: CommandEnv {{ + clear: false, + vars: {{ + "BAR": None, + }}, + }}, +{PIDFD}}}"# + ) + ); } // See issue #91991 |
