diff --git a/clients/go/pipeio/pipeio.go b/clients/go/pipeio/pipeio.go index c93e49e..24bc871 100644 --- a/clients/go/pipeio/pipeio.go +++ b/clients/go/pipeio/pipeio.go @@ -2,9 +2,12 @@ package pipeio import ( "os" + "io" "bufio" ) +const defaultBufSize = 65536 + type pipeReader struct { pipe *os.File @@ -21,6 +24,7 @@ func NewPipeReader(pipePath string) (*pipeReader, error) { if err != nil { return nil, err } + scanner.Buffer(make([]byte, defaultBufSize), defaultBufSize) return &pipeReader{ pipe: pipe, scanner: scanner, @@ -50,9 +54,16 @@ func (preader *pipeReader) RecvMessage() []byte { if preader.scanner.Scan() { return preader.scanner.Bytes() } + if err := preader.scanner.Err(); err != io.EOF { + panic(err) + } return nil } +func (preader *pipeReader) BufSize(size int) { + preader.scanner.Buffer(make([]byte, size), size) +} + type pipeWriter struct { pipe *os.File