Skip to content

Commit 3d1b206

Browse files
committed
Move to bufio reader to support larger tokens
1 parent bb46120 commit 3d1b206

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

internal/supervisor/output.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bufio"
55
"bytes"
66
"fmt"
7+
"io"
78
"log"
89
"os"
910
"sync"
@@ -54,10 +55,17 @@ func (m *multiOutput) PipeOutput(proc *process) {
5455
pipe := m.openPipe(proc)
5556

5657
go func(proc *process, pipe *ptyPipe) {
57-
scanner := bufio.NewScanner(pipe.pty)
58-
59-
for scanner.Scan() {
60-
m.WriteLine(proc, scanner.Bytes())
58+
reader := bufio.NewReader(pipe.pty)
59+
for {
60+
line, err := reader.ReadBytes('\n')
61+
if err != nil {
62+
// EOF is expected, so don't log it
63+
if err != io.EOF {
64+
log.Printf("reader error: %v", err)
65+
}
66+
break
67+
}
68+
m.WriteLine(proc, line)
6169
}
6270
}(proc, pipe)
6371
}

0 commit comments

Comments
 (0)