Files
magpie/internal/proc
yetone 421d5ce000 proc: a context that ends a running command says so off macOS too (#5967)
CombinedOutputOwn off macOS (and without cgo) was plain
cmd.CombinedOutput(). When the context killed a command that had
started, exec.Cmd's Wait said "signal: killed", while the macOS path
returns ctx.Err() whenever the context ended. TestCombinedOutputOwnContext
cancelled right away, so it passed when the cancel beat the start and
went red on ubuntu CI (run 43771048472 at 103eff4d4) when it didn't.
Now the run returns the context's error whenever it ended, as on macOS,
and the test cancels once before the start and once after the command
has written its mark, so the started case is no longer left to timing.

The only caller, restartCodexDaemon, puts err.Error() into its message
when the command printed nothing: a timed-out restart now says
"context deadline exceeded", not "signal: killed".

yinwu01 took #5967 on 11-10 with a patch described in the issue; none
landed in six days, so this is that change.

Run:
- wsl-run (Linux) go test -count=3 -run TestCombinedOutputOwn
  ./internal/proc: ok. Whole package -count=1: ok.
- mote-run (macOS 27, cgo) go test -count=1 ./internal/proc: ok.
- mote-run CGO_ENABLED=0 go test -run TestCombinedOutputOwn
  ./internal/proc (the non-macOS path on macOS): ok.
- mote-run GOOS=windows go vet ./internal/proc: ok. gofmt -l: clean.

Broken by hand: the old disclaim_other.go with the new test on Linux:
"started true: err signal: killed, want canceled", red every time.

Not tried: a full suite; a real codex daemon restart timing out.
2026-11-16 08:16:32 +08:00
..