X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Fstd%2Fsrc%2Fsys%2Fwindows%2Fprocess.rs;h=14de2530842f8da93d16558e109ee6ad50419c8f;hb=365a3586a94dc9ca675ddb02a86e116e8161481a;hp=81dbea4a067399755a1fd029fc3ed514c6c44e05;hpb=54bdfa125722c9ee6fadb61818f861b1102fd300;p=rust.git diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs index 81dbea4a067..14de2530842 100644 --- a/library/std/src/sys/windows/process.rs +++ b/library/std/src/sys/windows/process.rs @@ -530,6 +530,12 @@ fn make_envp(maybe_env: Option>) -> 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);