Test that env_clear works on Windows

This commit is contained in:
Chris Denton 2021-06-24 09:32:24 +01:00
parent 365a3586a9
commit 16145a9952
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE

View File

@ -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());
}