os/exec's StdoutPipe Footgun: How cmd.Wait() Ate My Last Frame (Twice)
Calling Wait while a StdoutPipe reader is still draining throws away the child's last output. I shipped this bug twice in shipmates.
shipmates spends most of its life spawning claude (and
codex) processes and reading newline-delimited JSON off their stdout. The last frame of a turn is the important one.
It’s a result frame with the cost, the model and the final text. Stderr matters too, because that’s where Claude Code
tells you Invalid API key · Please run /login. For a while I was throwing both away under load. The cause is
documented right there in the os/exec godoc. I fixed it in one package and then found the…
