diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2022-12-18 06:30:21 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-12-19 04:12:46 -0500 |
| commit | 3db8cffa3b383011471f425983a7e98ad8a46aa5 (patch) | |
| tree | ca5e55fe37d770c3774112f01bdb04448abdfcd6 /lib/std | |
| parent | 3bfae2a0d9503dbd832774c3b39a74dbd55e8b6e (diff) | |
| download | zig-3db8cffa3b383011471f425983a7e98ad8a46aa5.tar.gz zig-3db8cffa3b383011471f425983a7e98ad8a46aa5.zip | |
spawnWindows: Fix PATH searching when cwd is absolute
Fixes a regression caused by https://github.com/ziglang/zig/pull/13983
From the added comment:
We still search the path if the cwd is absolute because of the
"cwd set in ChildProcess is in effect when choosing the executable path
to match posix semantics" behavior--we don't want to skip searching
the PATH just because we were trying to set the cwd of the child process.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/child_process.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index 1cdbd2e9d1..7bff9fe089 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -1022,8 +1022,12 @@ pub const ChildProcess = struct { }; // If the app name had path separators, that disallows PATH searching, - // and there's no need to search the PATH if the cwd path is absolute. - if (app_dirname_w != null or fs.path.isAbsoluteWindowsWTF16(cwd_path_w)) { + // and there's no need to search the PATH if the app name is absolute. + // We still search the path if the cwd is absolute because of the + // "cwd set in ChildProcess is in effect when choosing the executable path + // to match posix semantics" behavior--we don't want to skip searching + // the PATH just because we were trying to set the cwd of the child process. + if (app_dirname_w != null or app_name_is_absolute) { return original_err; } |
