mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
feat(proxy): report blocked packages on stop, exit 1 if any were blocked
pmg proxy stop now waits for the proxy process to exit, reads the final blocked count written to the state file on shutdown, and exits non-zero when one or more packages were blocked during the session. This gives CI a clear failure signal from the proxy itself, separate from the package manager's own exit code.
This commit is contained in:
+7
-1
@@ -106,7 +106,13 @@ func runStart(_ *cobra.Command, _ []string) error {
|
||||
<-sigCh
|
||||
|
||||
close(confirmationChan)
|
||||
_ = proxystate.Remove(statePath)
|
||||
|
||||
// Write final blocked count before exiting so `pmg proxy stop` can read it.
|
||||
// stop is responsible for removing the state file.
|
||||
state.BlockedCount = stats.GetStats().BlockedCount
|
||||
if werr := proxystate.Write(statePath, state); werr != nil {
|
||||
log.Warnf("failed to write final proxy state: %v", werr)
|
||||
}
|
||||
|
||||
stopCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
Reference in New Issue
Block a user