diff --git a/scripts/start-server.ps1 b/scripts/start-server.ps1 index 3014089..904ebc9 100644 --- a/scripts/start-server.ps1 +++ b/scripts/start-server.ps1 @@ -228,7 +228,16 @@ try { $previousErrorActionPreference = $ErrorActionPreference try { $ErrorActionPreference = "Continue" + # Stringify before Tee-Object. With a bare `2>&1 |`, PowerShell wraps + # every line the child writes to stderr in an ErrorRecord, which prints + # as a red NativeCommandError block and reads as a failed migration -- + # even for ordinary informational output such as go-admin's + # "config init". Chasing individual stderr writers is whack-a-mole; this + # fixes the whole class. $LASTEXITCODE still reports the child's real + # exit code through the added pipeline stage, so failure detection below + # is unaffected. & go run . migrate -c config/settings.yml 2>&1 | + ForEach-Object { "$_" } | Tee-Object -FilePath $migrationLog $migrationExitCode = $LASTEXITCODE }