Files
multica/server/cmd
adai 7112606aef test(cli): drain captured stdout while the command runs (#8531)
The cmd/multica tests redirect os.Stdout into an os.Pipe and read it only
once the command has returned. Nothing drains the read end in between, so
a command can print no more than the pipe will buffer before its write
blocks and never completes.

On Linux that buffer is 64KB and nothing here reaches it. On macOS a pipe
with no reader stops accepting writes after 512 bytes, so any test whose
command prints a sizeable JSON payload deadlocks outright:
go test ./cmd/multica/ runs until the binary's timeout instead of
finishing, and -run on a single such test reproduces it on its own.

Start the reader before running the command, in every place that captures
a pipe this way. captureStderr already did this; the shape just had not
reached the stdout side or the copies inlined into individual tests.

The package went from never completing inside a 500s timeout to passing
in under two seconds.
2026-09-18 12:36:14 +08:00
..