diff --git a/shell/shell.go b/shell/shell.go index c0b6aec..f9781e6 100644 --- a/shell/shell.go +++ b/shell/shell.go @@ -23,6 +23,8 @@ var shellTesting bool var Default = "modd" +const maxLineLen = 64 * 1024 + type Executor struct { Shell string Command string @@ -162,7 +164,7 @@ func (e *Executor) Stop() error { func logOutput(wg *sync.WaitGroup, fp io.ReadCloser, out func(string, ...interface{})) { defer wg.Done() - r := bufio.NewReader(fp) + r := bufio.NewReaderSize(fp, maxLineLen) for { line, _, err := r.ReadLine() if err != nil { diff --git a/shell/shell_test.go b/shell/shell_test.go index 34ce388..711965e 100644 --- a/shell/shell_test.go +++ b/shell/shell_test.go @@ -90,6 +90,16 @@ func testCmd(t *testing.T, shell string, ct cmdTest) { } } +var longLine = func() string { + // 6K is longer than the default buffer size, but still well under the + // powershell command line length limit of 8191 + var runes [6 * 1024]rune + for i := range runes { + runes[i] = rune('0' + i%10) + } + return string(runes[:]) +}() + var shellTests = []cmdTest{ { name: "echosuccess", @@ -129,6 +139,11 @@ var shellTests = []cmdTest{ kill: true, procerr: true, }, + { + name: "longline", + cmd: "echo " + longLine + "; true", + logHas: longLine, + }, } func TestShells(t *testing.T) {