diff --git a/clients/go/pipeio/pipeio.go b/clients/go/pipeio/pipeio.go index 24bc871..00f32b1 100644 --- a/clients/go/pipeio/pipeio.go +++ b/clients/go/pipeio/pipeio.go @@ -4,6 +4,7 @@ import ( "os" "io" "bufio" + "errors" ) const defaultBufSize = 65536 @@ -54,14 +55,17 @@ func (preader *pipeReader) RecvMessage() []byte { if preader.scanner.Scan() { return preader.scanner.Bytes() } - if err := preader.scanner.Err(); err != io.EOF { + if err := preader.scanner.Err(); err != nil && err != io.EOF { + if err == bufio.ErrTooLong { + err = errors.New("pipeReader buffer too small!") + } panic(err) } return nil } func (preader *pipeReader) BufSize(size int) { - preader.scanner.Buffer(make([]byte, size), size) + preader.scanner.Buffer(make([]byte, defaultBufSize), size) }