Skip to content

Commit bf6a0dd

Browse files
committed
fix(ci): retry vp implode on Windows to handle transient file locks
Windows file locks can cause "Access is denied" errors during vp implode. Add retry logic (up to 3 attempts, 5s wait) to all three implode test variants (bash, powershell, cmd), Windows-only.
1 parent 51e48c9 commit bf6a0dd

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,16 @@ jobs:
521521
- name: Test implode (bash)
522522
shell: bash
523523
run: |
524-
vp implode --yes
524+
# Retry on Windows — file locks can cause transient "Access is denied" errors
525+
if [[ "$RUNNER_OS" == "Windows" ]]; then
526+
for i in 1 2 3; do
527+
vp implode --yes && break
528+
echo "Retry $i: vp implode failed, waiting 5s..."
529+
sleep 5
530+
done
531+
else
532+
vp implode --yes
533+
fi
525534
ls -la ~/
526535
VP_HOME="${USERPROFILE:-$HOME}/.vite-plus"
527536
if [ -d "$VP_HOME" ]; then
@@ -536,7 +545,13 @@ jobs:
536545
if: ${{ matrix.os == 'windows-latest' }}
537546
shell: pwsh
538547
run: |
539-
vp implode --yes
548+
# Retry — Windows file locks can cause transient "Access is denied" errors
549+
foreach ($i in 1..3) {
550+
vp implode --yes
551+
if ($LASTEXITCODE -eq 0) { break }
552+
Write-Host "Retry $i`: vp implode failed, waiting 5s..."
553+
Start-Sleep -Seconds 5
554+
}
540555
Start-Sleep -Seconds 5
541556
dir "$env:USERPROFILE\"
542557
if (Test-Path "$env:USERPROFILE\.vite-plus") {
@@ -550,9 +565,16 @@ jobs:
550565
if: ${{ matrix.os == 'windows-latest' }}
551566
shell: cmd
552567
run: |
568+
REM Retry — Windows file locks can cause transient "Access is denied" errors
553569
REM vp.exe renames its own parent directory; cmd.exe may report
554570
REM "The system cannot find the path specified" on exit — ignore it.
555-
vp implode --yes || ver >NUL
571+
for /L %%i in (1,1,3) do (
572+
vp implode --yes || ver >NUL
573+
if not exist "%USERPROFILE%\.vite-plus" goto implode_done
574+
echo Retry %%i: vp implode failed, waiting 5s...
575+
timeout /T 5 /NOBREAK >NUL
576+
)
577+
:implode_done
556578
timeout /T 5 /NOBREAK >NUL
557579
dir "%USERPROFILE%\"
558580
if exist "%USERPROFILE%\.vite-plus" (

0 commit comments

Comments
 (0)