Commit 3c2c9c2
committed
Fix: share bufio.Scanner across ExecuteCommand calls
bufio.NewScanner wraps the stdout pipe in an internal 4096-byte
read-ahead buffer. Creating a new Scanner on each ExecuteCommand call
discards any bytes already buffered from the previous call, causing
the next command's BEGIN_MARKER to be lost and the goroutine to block
indefinitely waiting for output that was already consumed.
Fix by creating the Scanner once in StartShell and reusing it for the
lifetime of the shell process.
Closes #711 parent bbbe55f commit 3c2c9c2
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
120 | | - | |
121 | | - | |
122 | | - | |
| 121 | + | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
0 commit comments