Skip to content

Commit f30b9d5

Browse files
committed
Fix Windows Command search path bug
1 parent 4857341 commit f30b9d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: std/src/sys/pal/windows/process.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,10 @@ impl Command {
260260
needs_stdin: bool,
261261
proc_thread_attribute_list: Option<&ProcThreadAttributeList<'_>>,
262262
) -> io::Result<(Process, StdioPipes)> {
263+
let env_saw_path = self.env.have_changed_path();
263264
let maybe_env = self.env.capture_if_changed();
264265

265-
let child_paths = if let Some(env) = maybe_env.as_ref() {
266+
let child_paths = if env_saw_path && let Some(env) = maybe_env.as_ref() {
266267
env.get(&EnvKey::new("PATH")).map(|s| s.as_os_str())
267268
} else {
268269
None

0 commit comments

Comments
 (0)