diff --git a/internal/components/engram/download.go b/internal/components/engram/download.go index e1bacca6e..d4f353392 100644 --- a/internal/components/engram/download.go +++ b/internal/components/engram/download.go @@ -605,6 +605,7 @@ if ($procs) { Write-Output "WARNING: $($remaining.Count) engram process(es) could not be stopped (access denied or still running). The upgrade may fail if the file is still locked." } } +exit 0 ` } diff --git a/internal/components/engram/download_test.go b/internal/components/engram/download_test.go index 8c936a49a..1676d1366 100644 --- a/internal/components/engram/download_test.go +++ b/internal/components/engram/download_test.go @@ -1280,4 +1280,10 @@ func TestEngramStopScriptIsDefensive(t *testing.T) { if strings.Contains(script, "Stop-Process -Force -ErrorAction Stop") { t.Errorf("stop script must not use -ErrorAction Stop on Stop-Process (reintroduces issue #815/#850)\nscript:\n%s", script) } + + // The clean/no-process path must report success explicitly, regardless of any + // PowerShell status left behind by defensive no-op commands. + if !strings.HasSuffix(strings.TrimSpace(script), "exit 0") { + t.Errorf("stop script must explicitly exit 0 on the clean/no-process path\nscript:\n%s", script) + } }