Skip to content

Commit eeafab4

Browse files
Copilotlpcox
andauthored
test: report stdout pipe cleanup errors in completion tests
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/0247f7a2-b758-496f-b765-effc1dd5b27f Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent 0d81b8b commit eeafab4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

internal/cmd/completion_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"bytes"
5+
"errors"
56
"io"
67
"os"
78
"strings"
@@ -28,8 +29,12 @@ func captureStdoutDuring(t *testing.T, fn func()) string {
2829
if os.Stdout != orig {
2930
os.Stdout = orig
3031
}
31-
_ = w.Close()
32-
_ = r.Close()
32+
if closeErr := w.Close(); closeErr != nil && !errors.Is(closeErr, os.ErrClosed) {
33+
t.Errorf("failed to close stdout pipe writer: %v", closeErr)
34+
}
35+
if closeErr := r.Close(); closeErr != nil && !errors.Is(closeErr, os.ErrClosed) {
36+
t.Errorf("failed to close stdout pipe reader: %v", closeErr)
37+
}
3338
}()
3439

3540
var buf bytes.Buffer

0 commit comments

Comments
 (0)