Documentation
¶
Index ¶
Constants ¶
View Source
const StdoutBufferSize = 40 * 1024
The buffer size used to read stdout/stderr output from subprocesses, in bytes. Effectively this determines the maximum line length that can be handled in one go. Lines that are longer will be broken up.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIRunner ¶
type CLIRunner struct {
// contains filtered or unexported fields
}
CLIRunner is a wrapper around exec.CommandContext() to allow mocking.
func NewCLIRunner ¶
func NewCLIRunner() *CLIRunner
func (*CLIRunner) CommandContext ¶
func (*CLIRunner) RunWithTextOutput ¶
func (cli *CLIRunner) RunWithTextOutput( ctx context.Context, logger zerolog.Logger, execCmd *exec.Cmd, logChunker LogChunker, lineChannel chan<- string, ) error
RunWithTextOutput runs a command and sends its output line-by-line to the lineChannel. Stdout and stderr are combined. Before returning. RunWithTextOutput() waits for the subprocess, to ensure it doesn't become defunct.
Note that all output read from the command is logged via `logChunker` as well, so the receiving end of the `lineChannel` does not have to do this.
Click to show internal directories.
Click to hide internal directories.