Documentation
¶
Index ¶
- type ExecResult
- type Executor
- type LinuxExecutor
- func (l *LinuxExecutor) RunCommand(command string, args ...string) *ExecResult
- func (l *LinuxExecutor) RunCommandWithRetries(retries int, okExitCodes []int, command string, args ...string) *ExecResult
- func (l *LinuxExecutor) RunCommandWithRetriesAndDelay(retries int, retryWaitMilliseconds int, okExitCodes []int, command string, ...) *ExecResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecResult ¶
type ExecResult struct {
StdOut string
StdErr string
ExitCode int
Duration time.Duration
Err error
}
ExecResult returns the outcome of linux command execution
type Executor ¶
type Executor interface {
// RunCommand runs a command once and returns ExecResult
RunCommand(command string, args ...string) *ExecResult
// RunCommandWithRetries runs a command until the ExecResult.ExitCode is in okExitCodes or
// the maximum number of retries is reached. Commands are executed one after another without
// any delay.
RunCommandWithRetries(retries int, okExitCodes []int, command string, args ...string) *ExecResult
// RunCommandWithRetriesAndDelay runs a command until the ExecResult.ExitCode is in okExitCodes or
// the maximum number of retries is reached. Commands are executed one after another with a delay
// of retryWaitMilliseconds between each execution.
RunCommandWithRetriesAndDelay(retries int, retryWaitMilliseconds int, okExitCodes []int,
command string, args ...string) *ExecResult
}
Executor allows you to run operating system commands from go
type LinuxExecutor ¶
type LinuxExecutor struct {
}
LinuxExecutor implements Executor for Linux
func (*LinuxExecutor) RunCommand ¶
func (l *LinuxExecutor) RunCommand(command string, args ...string) *ExecResult
RunCommand runs a command once and returns ExecResult
func (*LinuxExecutor) RunCommandWithRetries ¶
func (l *LinuxExecutor) RunCommandWithRetries(retries int, okExitCodes []int, command string, args ...string) *ExecResult
RunCommandWithRetries runs a command until the ExecResult.ExitCode is in okExitCodes or the maximum number of retries is reached. Commands are executed one after another without any delay.
func (*LinuxExecutor) RunCommandWithRetriesAndDelay ¶
func (l *LinuxExecutor) RunCommandWithRetriesAndDelay(retries int, retryWaitMilliseconds int, okExitCodes []int, command string, args ...string) *ExecResult
RunCommandWithRetriesAndDelay runs a command until the ExecResult.ExitCode is in okExitCodes or the maximum number of retries is reached. Commands are executed one after another with a delay of retryWaitMilliseconds between each execution.