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() }