mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
Add clilog.DiscardOnPipeError, an io.Writer wrapper that drops writes failing with io.ErrClosedPipe or syscall.EPIPE, and apply it to the clilog stdout/stderr sinks and the port-forward verbose sink. Background goroutines (e.g. port-forward -v tailnet goroutines) keep logging after the reader on the log destination is gone. slog reports those failed writes to stderr, which is noise and can interleave with and corrupt go test/test2json output, misreporting passing tests as failed. os.ErrClosed and all other errors are still returned, so writes to a writer we closed ourselves are not hidden, and normal CLI pipe semantics are unchanged.