about summary refs log tree commit diff
path: root/library/std/src/process
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2021-06-24 09:32:24 +0100
committerChris Denton <christophersdenton@gmail.com>2021-06-24 09:32:24 +0100
commit16145a99528c862cfaca87e836fdd844ba155567 (patch)
treecdbc9d6f13df2a2dcfb26e5f29e723d44da2f584 /library/std/src/process
parent365a3586a94dc9ca675ddb02a86e116e8161481a (diff)
downloadrust-16145a99528c862cfaca87e836fdd844ba155567.tar.gz
rust-16145a99528c862cfaca87e836fdd844ba155567.zip
Test that `env_clear` works on Windows
Diffstat (limited to 'library/std/src/process')
-rw-r--r--library/std/src/process/tests.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs
index 05e093434be..bc71c150550 100644
--- a/library/std/src/process/tests.rs
+++ b/library/std/src/process/tests.rs
@@ -399,3 +399,12 @@ fn test_command_implements_send_sync() {
     fn take_send_sync_type<T: Send + Sync>(_: T) {}
     take_send_sync_type(Command::new(""))
 }
+
+// Ensure that starting a process with no environment variables works on Windows.
+// This will fail if the environment block is ill-formed.
+#[test]
+#[cfg(windows)]
+fn env_empty() {
+    let p = Command::new("cmd").args(&["/C", "exit 0"]).env_clear().spawn();
+    assert!(p.is_ok());
+}