Documentation
¶
Index ¶
- func CallablePath(path string) string
- type Cmd
- func (c *Cmd) Run() error
- func (c *Cmd) Start() error
- func (c *Cmd) StderrTeePipe(writer io.Writer) (io.ReadCloser, error)
- func (c *Cmd) StdoutTeePipe(writer io.Writer) (io.ReadCloser, error)
- func (c *Cmd) TerminateProcessGroup() error
- func (c *Cmd) TerminatedAfterContextDone() bool
- func (c *Cmd) Wait() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallablePath ¶
CallablePath returns a path that is equivalent to its argument and can be invoked via exec.Command and its variants. For example, it turns "my_binary" into "./my_binary" on Unix.
Types ¶
type Cmd ¶
Cmd provides the same functionality as exec.Cmd plus some utility methods.
func CommandContext ¶
CommandContext is like Command but includes a context.
The provided context is used to terminate the process group (by first sending SIGTERM to the process group and after a grace period of 3 seconds SIGKILL) if the context becomes done before the command completes on its own. In that case, Cmd.TerminatedAfterContextDone() returns true.
func (*Cmd) Start ¶
Does the same as exec.Cmd.Start(), but also closes the write ends of tee pipes (if there are any) on the same errors that exec.Cmd.Start() closes its open pipes.
func (*Cmd) StderrTeePipe ¶
Same as StdoutTeePipe but for stderr.
func (*Cmd) StdoutTeePipe ¶
StdoutTeePipe is similar to StdoutPipe, but everything written to the pipe is also copied to the specified writer (similar to tee(1)).
In contrast to StdoutPipe, Wait will *not* automatically close the pipe, so it's the caller's responsibility to close the pipe. In effect, it is fine to call Wait before all reads from the pipe have completed.