diff options
Diffstat (limited to 'golib/eows/eows-out.go')
-rw-r--r-- | golib/eows/eows-out.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/golib/eows/eows-out.go b/golib/eows/eows-out.go index 3abbdc0..2a6b110 100644 --- a/golib/eows/eows-out.go +++ b/golib/eows/eows-out.go @@ -3,9 +3,10 @@ package eows import ( "bufio" "io" + "strings" ) -// scanBlocks +// scanBlocks - gain character by character (or as soon as one or more characters are available) func scanBlocks(data []byte, atEOF bool) (advance int, token []byte, err error) { if atEOF && len(data) == 0 { return 0, nil, nil @@ -20,7 +21,12 @@ func (e *ExecOverWS) cmdPumpStdout(r io.Reader, done chan struct{}) { }() sc := bufio.NewScanner(r) + + // else use default sc.ScanLines + if e.OutSplit == SplitChar { sc.Split(scanBlocks) + } + for sc.Scan() { e.OutputCB(e, sc.Text(), "") } @@ -37,7 +43,12 @@ func (e *ExecOverWS) cmdPumpStderr(r io.Reader) { defer func() { }() sc := bufio.NewScanner(r) + + // else use default sc.ScanLines + if e.OutSplit == SplitChar { sc.Split(scanBlocks) + } + for sc.Scan() { e.OutputCB(e, "", sc.Text()) } |