mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Windows: Fix Command::env_clear
so it works
Previously, it would error unless at least one new environment variable was added.
This commit is contained in:
parent
9839f9c7ff
commit
365a3586a9
@ -530,6 +530,12 @@ fn make_envp(maybe_env: Option<BTreeMap<EnvKey, OsString>>) -> io::Result<(*mut
|
||||
if let Some(env) = maybe_env {
|
||||
let mut blk = Vec::new();
|
||||
|
||||
// If there are no environment variables to set then signal this by
|
||||
// pushing a null.
|
||||
if env.is_empty() {
|
||||
blk.push(0);
|
||||
}
|
||||
|
||||
for (k, v) in env {
|
||||
blk.extend(ensure_no_nuls(k.0)?.encode_wide());
|
||||
blk.push('=' as u16);
|
||||
|
Loading…
Reference in New Issue
Block a user