Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Process ¶
type Process interface { // Wait blocks to wait for the process to exit. Wait() error // contains filtered or unexported methods }
Process represents a background process.
func Start ¶
Start runs the external command, returning a Process to track its progress.
Stdin, stdout, stderr, and env will be explicitly set to nil/empty values if not set with options. The command will be killed if the Context is cancelled.
This should be used instead of exec.Command(...).Start().
type RunOption ¶
type RunOption interface {
// contains filtered or unexported methods
}
RunOption is an option for Run.
type RunStartOption ¶
type RunStartOption interface { RunOption StartOption }
RunStartOption is both a RunOption and a StartOption.
We split out RunOptions and StartOptions for maximum future flexibility, in case we ever want the options for Run and Start to deviate.
func WithArgs ¶
func WithArgs(args ...string) RunStartOption
WithArgs returns a new option that sets the arguments other than the name.
The default is no additional arguments.
func WithDir ¶
func WithDir(dir string) RunStartOption
WithDir returns a new option that sets the working directory.
The default is the current working directory.
func WithEnv ¶
func WithEnv(env []string) RunStartOption
WithEnv returns a new option that sets the environment variables.
The default is to use the single envment variable __EMPTY_ENV__=1 as we cannot explicitly set an empty envment with the exec package.
If this and WithEnv are specified, the last option specified wins.
func WithStderr ¶
func WithStderr(stderr io.Writer) RunStartOption
WithStderr returns a new option that sets the stderr.
The default is a io.Writer that ignores all writes..
func WithStdin ¶
func WithStdin(stdin io.Reader) RunStartOption
WithStdin returns a new option that sets the stdin.
The default is a io.Reader that always returns empty..
func WithStdout ¶
func WithStdout(stdout io.Writer) RunStartOption
WithStdout returns a new option that sets the stdout.
The default is a io.Writer that ignores all writes..
type StartOption ¶
type StartOption interface {
// contains filtered or unexported methods
}
StartOption is an option for Start.