diff --git a/scripts/dev-db.ps1 b/scripts/dev-db.ps1 index 390403b..cc397f5 100644 --- a/scripts/dev-db.ps1 +++ b/scripts/dev-db.ps1 @@ -34,8 +34,13 @@ $Image = 'postgres:17' $ConnectionString = 'Host=localhost;Database=yeschef;Username=yeschef;Password=yeschef' function Get-ContainerState { - $state = docker inspect --format '{{.State.Status}}' $Name 2>$null - if ($LASTEXITCODE -ne 0) { return 'absent' } + # docker inspect exits non-zero when the container is missing; swallow + # that so $ErrorActionPreference='Stop' doesn't abort the script and + # so the caller's exit code stays clean. + $state = & docker inspect --format '{{.State.Status}}' $Name 2>$null + $code = $LASTEXITCODE + $global:LASTEXITCODE = 0 + if ($code -ne 0) { return 'absent' } return $state }