From ab20d50dba07ce4e0fde35fca802b5deb246b5ee Mon Sep 17 00:00:00 2001 From: cui Date: Thu, 28 May 2026 00:27:35 +0800 Subject: [PATCH] log: return TerminalHandler write errors from Handle (#35055) Propagate slog Handle failures when the underlying io.Writer rejects output. --- log/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/log/handler.go b/log/handler.go index 56eff6671f..9c98552e7c 100644 --- a/log/handler.go +++ b/log/handler.go @@ -77,9 +77,9 @@ func (h *TerminalHandler) Handle(_ context.Context, r slog.Record) error { h.mu.Lock() defer h.mu.Unlock() buf := h.format(h.buf, r, h.useColor) - h.wr.Write(buf) + _, err := h.wr.Write(buf) h.buf = buf[:0] - return nil + return err } func (h *TerminalHandler) Enabled(_ context.Context, level slog.Level) bool {