Skip to content

Commit ba89a4e

Browse files
committed
handle body read errors similarly
1 parent ced33cb commit ba89a4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

go/internal/jsonrpc2/jsonrpc2.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,10 @@ func (c *Client) readLoop() {
333333
// Read message body
334334
body := make([]byte, contentLength)
335335
if _, err := io.ReadFull(reader, body); err != nil {
336-
fmt.Printf("Error reading body: %v\n", err)
336+
// Only log unexpected errors (not EOF or closed pipe during shutdown)
337+
if err != io.EOF && !errors.Is(err, os.ErrClosed) && c.running.Load() {
338+
fmt.Printf("Error reading body: %v\n", err)
339+
}
337340
return
338341
}
339342

0 commit comments

Comments
 (0)