File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff 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"
@@ -320,7 +322,7 @@ func (c *Client) readLoop() {
320322 line , err := reader .ReadString ('\n' )
321323 if err != nil {
322324 // Only log unexpected errors (not EOF or closed pipe during shutdown)
323- if err != io .EOF && c .running .Load () {
325+ if err != io .EOF && ! errors . Is ( err , os . ErrClosed ) && c .running .Load () {
324326 fmt .Printf ("Error reading header: %v\n " , err )
325327 }
326328 return
@@ -345,7 +347,10 @@ func (c *Client) readLoop() {
345347 // Read message body
346348 body := make ([]byte , contentLength )
347349 if _ , err := io .ReadFull (reader , body ); err != nil {
348- fmt .Printf ("Error reading body: %v\n " , err )
350+ // Only log unexpected errors (not EOF or closed pipe during shutdown)
351+ if err != io .EOF && ! errors .Is (err , os .ErrClosed ) && c .running .Load () {
352+ fmt .Printf ("Error reading body: %v\n " , err )
353+ }
349354 return
350355 }
351356
You can’t perform that action at this time.
0 commit comments