fix(test-runner): preserve PATHEXT for native PowerShell children

This commit is contained in:
ethernet
2026-09-21 14:03:12 -04:00
parent c69ccc3bf1
commit d2c60dbdf8
2 changed files with 8 additions and 4 deletions

View File

@@ -113,12 +113,14 @@ fi
# resolves Path.home() from USERPROFILE (or HOMEDRIVE+HOMEPATH), stdlib
# platform paths come from LOCALAPPDATA/APPDATA, ssl/sockets need SYSTEMROOT,
# and tempfile needs TEMP/TMP. Dropping them breaks collection on native
# Windows (issues #67385, #70813). These are location variables, not
# Windows (issues #67385, #70813). PATHEXT is also required: without .EXE,
# PowerShell can return success without executing a native child.
# These are location variables, not
# credentials, so forwarding them keeps the isolation intent intact. Each is
# only forwarded when actually set, so POSIX runs are byte-for-byte unchanged.
WIN_ENV=()
for _win_var in USERPROFILE HOMEDRIVE HOMEPATH LOCALAPPDATA APPDATA SYSTEMROOT TEMP TMP \
ComSpec PROGRAMFILES ProgramFiles PROGRAMDATA ProgramData; do
ComSpec PATHEXT PROGRAMFILES ProgramFiles PROGRAMDATA ProgramData; do
if [ -n "${!_win_var:-}" ]; then
WIN_ENV+=("$_win_var=${!_win_var}")
fi