Documentation ¶
Index ¶
Constants ¶
const UnknownExit = 1
UnknownExit is used when the return/exit-code of the command is not known.
Variables ¶
var BufferSize = 1048576
BufferSize determines how much output will be read into memory before resorting to using a temporary file
var WaitingMultiplier = 4
WaitingMultiplier determines how many finished processes can be waiting before Runner blocks waiting for the slowest process finishes. Increasing this improves concurrency at the expense of memory.
Functions ¶
func Cleanup ¶ added in v0.3.6
func Cleanup()
Cleanup is a best-effort to remove all temporary files created by process. Users can call it manually to remove them.
Types ¶
type CallBack ¶ added in v0.3.6
type CallBack func(io.Reader, io.WriteCloser) error
CallBack is an optional function the user can provide to process the stdout stream of the called Command. The user is responsible for closing the io.Writer
type Command ¶
type Command struct { *bufio.Reader Err error CmdStr string Duration time.Duration // contains filtered or unexported fields }
Command contains a buffered reader with the realized stdout of the process along with the exit code.
func Run ¶
Run takes a command string, executes the command, Blocks until the output is finished and returns a *Command that is an io.Reader. See Options for additional details.
func (*Command) Cleanup ¶ added in v0.3.5
func (c *Command) Cleanup()
Cleanup makes sure the tempfile is closed an deleted.
type Options ¶ added in v0.3.6
type Options struct { // A callback to be applied to the output of the command. The user is responsible // for closing the io.Writer insde the this function. CallBack CallBack // Ordered keeps the output in order even when the processes finish in a different order.io // This can come at the expense of performance when waiting on a long process. Ordered bool // Retries indicates the number of times a process will be retried if it has // a non-zero exit code. Retries int }
Options holds the options to send to Runner.