Documentation ¶
Overview ¶
Package subprocess provides functionality to execute system commands.
Index ¶
- func Exists(pid int) (bool, error)
- type SystemExecutor
- func (SystemExecutor) Execute(ctx context.Context, cmd *command.Command) (string, string, error)
- func (SystemExecutor) ExecuteInBackground(ctx context.Context, cmd *command.Command, oe outerr.OutErr, ...) error
- func (SystemExecutor) ExecuteWithOutErr(ctx context.Context, cmd *command.Command, oe outerr.OutErr) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SystemExecutor ¶
type SystemExecutor struct{}
SystemExecutor uses the native os/exec package to execute subprocesses.
func (SystemExecutor) Execute ¶
Execute runs the given command and returns stdout and stderr. Returns *exec.ExitError if the command ran with a non-zero exit code.
func (SystemExecutor) ExecuteInBackground ¶
func (SystemExecutor) ExecuteInBackground(ctx context.Context, cmd *command.Command, oe outerr.OutErr, ch chan *command.Result) error
ExecuteInBackground executes the command in the background. Command result is written to the passed channel.
func (SystemExecutor) ExecuteWithOutErr ¶
func (SystemExecutor) ExecuteWithOutErr(ctx context.Context, cmd *command.Command, oe outerr.OutErr) error
ExecuteWithOutErr runs the given command and returns stdout and stderr in an OutErr object. Returns *exec.ExitError if the command ran with a non-zero exit code.
Click to show internal directories.
Click to hide internal directories.