CI: make the Windows Electron download retry actually retry (#330536)

Make the Windows Electron download retry actually retry

The step wraps the download in a 3-attempt loop, but the retry never
fired. `npm exec` is a native command, and a non-zero exit code from a
native command does not raise a terminating error in PowerShell, so the
`catch` block was unreachable: the first attempt fell through to `break`
and the step then failed on the non-zero exit code.

Wrap the call in `exec { }` from build/azure-pipelines/win32/exec.ps1,
which checks $lastexitcode and throws. This is the same shape the `npm
ci` retry in this file already uses, and it is why that one works.

Seen on a PR run where a transient socket close while fetching Electron
from github.com failed the job on the first attempt, with no retry:

  TypeError: fetch failed
    cause: SocketError: other side closed (UND_ERR_SOCKET)
    at @vscode/gulp-electron/src/download.js

The Linux and macOS workflows are unaffected: their loops use
`if npm exec ...; then`, which tests the exit code directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3c35355f-4d36-46e5-8d7a-cb0bc7207449
This commit is contained in:
Logan Ramos
2026-08-12 22:38:20 +00:00
committed by GitHub
co-authored by Copilot
parent 690978d93a
commit 407d9757f0
+4 -1
View File
@@ -115,9 +115,12 @@ jobs:
- name: Download Electron and Playwright
shell: pwsh
run: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
for ($i = 1; $i -le 3; $i++) {
try {
npm exec -- npm-run-all2 -lp "electron ${{ env.VSCODE_ARCH }}" "playwright-install"
exec { npm exec -- npm-run-all2 -lp "electron ${{ env.VSCODE_ARCH }}" "playwright-install" }
break
}
catch {