From aff3bcb8a0b6215b99175c0c3a2c5786d7b3734f Mon Sep 17 00:00:00 2001 From: "benjamin.baker" Date: Wed, 2 Sep 2026 08:18:18 -0400 Subject: [PATCH] keep launcher cleanup from aborting on docker stderr warnings docker/compose emit warnings on stderr (e.g. nothing to remove), which tripped ErrorActionPreference=Stop and killed the run before the clone. soften the preference around the best-effort cleanup steps. --- scripts/Start-ShopDBDev.ps1 | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/scripts/Start-ShopDBDev.ps1 b/scripts/Start-ShopDBDev.ps1 index 42b3b1a5..ec6ff9f8 100644 --- a/scripts/Start-ShopDBDev.ps1 +++ b/scripts/Start-ShopDBDev.ps1 @@ -61,16 +61,27 @@ function Clear-InterruptedRun { ) if (Get-Command docker -ErrorAction SilentlyContinue) { - # Only try compose down when the engine is actually responding, otherwise - # skip quietly - a fresh box may not have Docker started yet. - docker info *> $null - if ($LASTEXITCODE -eq 0) { - Write-Host "==> Cleaning up any interrupted '$Project' stack" -ForegroundColor Cyan - # --remove-orphans clears containers left by a killed build; volumes are - # intentionally kept so the DB survives a retry. - docker compose -p $Project down --remove-orphans *> $null - # Reclaim only dangling build cache from failed/partial builds. - docker builder prune -f *> $null + # docker/compose write warnings to stderr (e.g. "No resource found to + # remove"), which would trip $ErrorActionPreference='Stop' and abort the + # whole run. These cleanup steps are best-effort, so soften the preference + # and swallow all streams for their duration. + $previous = $ErrorActionPreference + $ErrorActionPreference = 'Continue' + try { + # Only try compose down when the engine is actually responding, otherwise + # skip quietly - a fresh box may not have Docker started yet. + docker info *> $null + if ($LASTEXITCODE -eq 0) { + Write-Host "==> Cleaning up any interrupted '$Project' stack" -ForegroundColor Cyan + # --remove-orphans clears containers left by a killed build; volumes are + # intentionally kept so the DB survives a retry. + docker compose -p $Project down --remove-orphans *> $null + # Reclaim only dangling build cache from failed/partial builds. + docker builder prune -f *> $null + } + } + finally { + $ErrorActionPreference = $previous } }