From c9e8d86784c1f744977d178b19f377688b2cdc66 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 25 Apr 2023 10:19:35 -0500 Subject: [PATCH] Windows? --- library/std/src/sys/windows/process.rs | 6 +++++- library/std/src/sys_common/process.rs | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs index f4078d359448e..eefb0a482da8c 100644 --- a/library/std/src/sys/windows/process.rs +++ b/library/std/src/sys/windows/process.rs @@ -26,7 +26,7 @@ use crate::sys::handle::Handle; use crate::sys::path; use crate::sys::pipe::{self, AnonPipe}; use crate::sys::stdio; -use crate::sys_common::process::{CommandEnv, CommandEnvs}; +use crate::sys_common::process::{CapturedEnvs, CommandEnv, CommandEnvs}; use crate::sys_common::IntoInner; use core::ffi::c_void; @@ -244,6 +244,10 @@ impl Command { self.env.iter() } + pub fn capture_envs(&self) -> CapturedEnvs { + self.env.capture_iter() + } + pub fn get_current_dir(&self) -> Option<&Path> { self.cwd.as_ref().map(|cwd| Path::new(cwd)) } diff --git a/library/std/src/sys_common/process.rs b/library/std/src/sys_common/process.rs index fc9f0deea1f32..4a69d6f0237dc 100644 --- a/library/std/src/sys_common/process.rs +++ b/library/std/src/sys_common/process.rs @@ -114,8 +114,9 @@ impl CommandEnv { /// /// See [`Command::capture_envs`][crate::process::Command::capture_envs] documentation for more. pub struct CapturedEnvs { - iter: crate::collections::btree_map::IntoIter, + iter: crate::collections::btree_map::IntoIter, } + impl Iterator for CapturedEnvs { type Item = (OsString, OsString); fn next(&mut self) -> Option<(OsString, OsString)> {