about summary refs log tree commit diff
path: root/library/std/src/sys/unix/process
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/sys/unix/process')
-rw-r--r--library/std/src/sys/unix/process/process_common.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
index 23d9f3b78ee..957947a674a 100644
--- a/library/std/src/sys/unix/process/process_common.rs
+++ b/library/std/src/sys/unix/process/process_common.rs
@@ -562,21 +562,17 @@ impl fmt::Debug for Command {
                 write!(f, "env -i ")?;
                 // Altered env vars will be printed next, that should exactly work as expected.
             } else {
-                // Removed env vars need a separate command.
-                // We use a single `unset` command for all of them.
+                // Removed env vars need the command to be wrappen in `env`.
                 let mut any_removed = false;
                 for (key, value_opt) in self.get_envs() {
                     if value_opt.is_none() {
                         if !any_removed {
-                            write!(f, "unset ")?;
+                            write!(f, "env ")?;
                             any_removed = true;
                         }
-                        write!(f, "{} ", key.to_string_lossy())?;
+                        write!(f, "-u {} ", key.to_string_lossy())?;
                     }
                 }
-                if any_removed {
-                    write!(f, "&& ")?;
-                }
             }
             // Altered env vars can just be added in front of the program.
             for (key, value_opt) in self.get_envs() {