From fd0fd8954a6000641cf3c974743927d3c9809f2b Mon Sep 17 00:00:00 2001 From: Kharec Date: Mon, 19 Jan 2026 16:37:22 +0100 Subject: [PATCH] fix: close captureOutput pipe before read --- cmd/goyco/commands/progress_indicator_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/goyco/commands/progress_indicator_test.go b/cmd/goyco/commands/progress_indicator_test.go index c38a8c1..8049088 100644 --- a/cmd/goyco/commands/progress_indicator_test.go +++ b/cmd/goyco/commands/progress_indicator_test.go @@ -44,15 +44,14 @@ func captureOutput(fn func()) string { r, w, _ := os.Pipe() os.Stdout = w - defer func() { - _ = w.Close() - os.Stdout = old - }() - fn() + _ = w.Close() + os.Stdout = old + var buf bytes.Buffer _, _ = io.Copy(&buf, r) + _ = r.Close() return buf.String() }