Skip to content

Commit 794c0f2

Browse files
committed
ci: keep double quotes out of the install_windows_deps bash check
Windows PowerShell 5.1 strips embedded double quotes when passing arguments to native commands, so `[ -n "$DEPENDENT_EXES" ]` reached bash as `[ -n curl unzip ... ]` and failed with "too many arguments", even with every tool present. Count the words with `set --` instead.
1 parent aa4689f commit 794c0f2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎.github/actions/install_windows_deps/action.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ runs:
2323
throw 'Expected a space-separated list of executable names.'
2424
}
2525
# Fail the check if the list did not reach Bash (a WSL bash would not receive it).
26-
$check = 'missing=0; [ -n "$DEPENDENT_EXES" ] || missing=1; for tool in $DEPENDENT_EXES; do command -v "$tool" || missing=1; done; exit "$missing"'
26+
# Keep double quotes out of $check: Windows PowerShell 5.1 strips them when
27+
# passing arguments to native commands. The names are validated above.
28+
$check = 'missing=0; set -- $DEPENDENT_EXES; [ $# -gt 0 ] || missing=1; for tool in $DEPENDENT_EXES; do command -v $tool || missing=1; done; exit $missing'
2729
# Skip the WSL launcher in System32/WindowsApps: it is not a Git for Windows bash.
2830
$bash = Get-Command bash -All -ErrorAction SilentlyContinue |
2931
Where-Object { $_.Source -notmatch '\\(System32|SysWOW64|WindowsApps)\\' } |

0 commit comments

Comments
 (0)