Documentation ¶
Overview ¶
Yet another wrapper of os/exec with an extended execution report
Index ¶
- type Command
- func (c *Command) GetResponse() *ExecutionResponse
- func (c *Command) Kill() error
- func (c *Command) Run() error
- func (c *Command) SetEnvironment(environment []string)
- func (c *Command) SetTimeout(timeout time.Duration)
- func (c *Command) SetUser(username string)
- func (c *Command) SetWorkingDir(workingDir string)
- func (c *Command) Wait() error
- type ExecutionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Stdout *bytes.Buffer Stderr *bytes.Buffer Pid int // contains filtered or unexported fields }
func NewCommand ¶
NewCommand returns the Command struct to execute the named program with the given arguments.
func (*Command) GetResponse ¶
func (c *Command) GetResponse() *ExecutionResponse
GetResponse returns a ExecutionResponse struct, must be called at the end of the execution
func (*Command) Run ¶
Run starts the specified command and waits for it to complete.
The returned error is nil if the command runs, has no problems copying stdin, stdout, and stderr, and exits with a zero exit status.
func (*Command) SetEnvironment ¶
SetEnvironment sets the environment of the process. If not is set, Run uses the current process's environment.
func (*Command) SetTimeout ¶
SetTimeout configure the limit amount of time to run
func (*Command) SetWorkingDir ¶
SetWorkingDir sets the working directory of the command. If not is set, Run runs the command in the calling process's current directory.