Skip to content

Commit ced33cb

Browse files
committed
Go: RPC client loop expects stdout close
1 parent 47cb899 commit ced33cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

go/internal/jsonrpc2/jsonrpc2.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import (
44
"bufio"
55
"crypto/rand"
66
"encoding/json"
7+
"errors"
78
"fmt"
89
"io"
10+
"os"
911
"reflect"
1012
"sync"
1113
"sync/atomic"
@@ -306,7 +308,7 @@ func (c *Client) readLoop() {
306308
line, err := reader.ReadString('\n')
307309
if err != nil {
308310
// Only log unexpected errors (not EOF or closed pipe during shutdown)
309-
if err != io.EOF && c.running.Load() {
311+
if err != io.EOF && !errors.Is(err, os.ErrClosed) && c.running.Load() {
310312
fmt.Printf("Error reading header: %v\n", err)
311313
}
312314
return

0 commit comments

Comments
 (0)