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.
This commit is contained in:
@@ -61,6 +61,13 @@ function Clear-InterruptedRun {
|
||||
)
|
||||
|
||||
if (Get-Command docker -ErrorAction SilentlyContinue) {
|
||||
# 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
|
||||
@@ -73,6 +80,10 @@ function Clear-InterruptedRun {
|
||||
docker builder prune -f *> $null
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$ErrorActionPreference = $previous
|
||||
}
|
||||
}
|
||||
|
||||
# A directory that exists but has no valid .git is a broken/partial clone;
|
||||
# remove it so the clone below can start fresh instead of failing.
|
||||
|
||||
Reference in New Issue
Block a user