Skip to content

Commit f9bfd49

Browse files
committed
Improved error checking in tests
1 parent 852865e commit f9bfd49

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/root_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,14 @@ func captureOutput(f func()) (string, string) {
466466
os.Stdout = w
467467
os.Stderr = w2
468468
f()
469-
w.Close()
470-
w2.Close()
469+
err = w.Close()
470+
if err != nil {
471+
panic(err)
472+
}
473+
err = w2.Close()
474+
if err != nil {
475+
panic(err)
476+
}
471477
out, err := io.ReadAll(r)
472478
if err != nil {
473479
panic(err)

0 commit comments

Comments
 (0)