{"modulePath":"github.com/devfactory/go-tools","version":"v0.2.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package command\n\n## Types\n\n```go\ntype ExecResult struct {\n\tStdOut   string\n\tStdErr   string\n\tExitCode int\n\tDuration time.Duration\n\tErr      error\n}\n```\nExecResult returns the outcome of linux command execution\n\n```go\ntype Executor interface {\n\t// RunCommand runs a command once and returns ExecResult\n\tRunCommand(command string, args ...string) *ExecResult\n\n\t// RunCommandWithRetries runs a command until the ExecResult.ExitCode is in okExitCodes or\n\t// the maximum number of retries is reached. Commands are executed one after another without\n\t// any delay.\n\tRunCommandWithRetries(retries int, okExitCodes []int, command string, args ...string) *ExecResult\n\n\t// RunCommandWithRetriesAndDelay runs a command until the ExecResult.ExitCode is in okExitCodes or\n\t// the maximum number of retries is reached. Commands are executed one after another with a delay\n\t// of retryWaitMilliseconds between each execution.\n\tRunCommandWithRetriesAndDelay(retries int, retryWaitMilliseconds int, okExitCodes []int,\n\t\tcommand string, args ...string) *ExecResult\n}\n```\nExecutor allows you to run operating system commands from go\n\n```go\nfunc NewExecutor() Executor\n```\nNewExecutor returns a new Linux command executor.\n\n```go\ntype LinuxExecutor struct {\n}\n```\nLinuxExecutor implements Executor for Linux\n\n```go\nfunc (l *LinuxExecutor) RunCommand(command string, args ...string) *ExecResult\n```\nRunCommand runs a command once and returns ExecResult\n\n```go\nfunc (l *LinuxExecutor) RunCommandWithRetries(retries int, okExitCodes []int, command string,\n\targs ...string) *ExecResult\n```\nRunCommandWithRetries 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.\n\n```go\nfunc (l *LinuxExecutor) RunCommandWithRetriesAndDelay(retries int, retryWaitMilliseconds int,\n\tokExitCodes []int, command string, args ...string) *ExecResult\n```\nRunCommandWithRetriesAndDelay 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.\n\n","path":"github.com/devfactory/go-tools/pkg/linux/command","name":"command","synopsis":"","isRedistributable":true}
