fix: close captureOutput pipe before read

This commit is contained in:
2026-01-19 16:37:22 +01:00
parent 628db14f59
commit fd0fd8954a

View File

@@ -44,15 +44,14 @@ func captureOutput(fn func()) string {
r, w, _ := os.Pipe() r, w, _ := os.Pipe()
os.Stdout = w os.Stdout = w
defer func() {
_ = w.Close()
os.Stdout = old
}()
fn() fn()
_ = w.Close()
os.Stdout = old
var buf bytes.Buffer var buf bytes.Buffer
_, _ = io.Copy(&buf, r) _, _ = io.Copy(&buf, r)
_ = r.Close()
return buf.String() return buf.String()
} }