fix fd0 read error on long stdout output (scanner buffer was too small)

This commit is contained in:
2023-02-13 01:41:33 +01:00
parent 4a2b830252
commit 9f5612248a
3 changed files with 23 additions and 7 deletions

View File

@@ -36,8 +36,9 @@ func run(opt CommandRunner) (CommandResult, error) {
}
preader := pipeReader{
stdout: stdoutPipe,
stderr: stderrPipe,
lineBufferSize: langext.Ptr(128 * 1024 * 1024), // 128MB max size of a single line, is hopefully enough....
stdout: stdoutPipe,
stderr: stderrPipe,
}
err = cmd.Start()
@@ -60,14 +61,17 @@ func run(opt CommandRunner) (CommandResult, error) {
stdout, stderr, stdcombined, err := preader.Read(opt.listener)
if err != nil {
outputChan <- resultObj{stdout, stderr, stdcombined, err}
_ = cmd.Process.Kill()
return
}
err = cmd.Wait()
if err != nil {
outputChan <- resultObj{stdout, stderr, stdcombined, err}
} else {
outputChan <- resultObj{stdout, stderr, stdcombined, nil}
}
outputChan <- resultObj{stdout, stderr, stdcombined, nil}
}()
var timeoutChan <-chan time.Time = make(chan time.Time, 1)