Documentation ¶
Index ¶
- func ExitStatus(err error) (int, bool)
- type CommandExecutor
- func (c *CommandExecutor) ExecuteCommand(command string, arg ...string) error
- func (*CommandExecutor) ExecuteCommandWithCombinedOutput(command string, arg ...string) (string, error)
- func (*CommandExecutor) ExecuteCommandWithEnv(env []string, command string, arg ...string) error
- func (*CommandExecutor) ExecuteCommandWithOutput(command string, arg ...string) (string, error)
- func (*CommandExecutor) ExecuteCommandWithOutputFile(command, outfileArg string, arg ...string) (string, error)
- func (*CommandExecutor) ExecuteCommandWithOutputFileTimeout(timeout time.Duration, command, outfileArg string, arg ...string) (string, error)
- func (*CommandExecutor) ExecuteCommandWithTimeout(timeout time.Duration, command string, arg ...string) (string, error)
- type Executor
- type TranslateCommandExecutor
- func (e *TranslateCommandExecutor) ExecuteCommand(command string, arg ...string) error
- func (e *TranslateCommandExecutor) ExecuteCommandWithCombinedOutput(command string, arg ...string) (string, error)
- func (e *TranslateCommandExecutor) ExecuteCommandWithEnv(env []string, command string, arg ...string) error
- func (e *TranslateCommandExecutor) ExecuteCommandWithOutput(command string, arg ...string) (string, error)
- func (e *TranslateCommandExecutor) ExecuteCommandWithOutputFile(command, outfileArg string, arg ...string) (string, error)
- func (e *TranslateCommandExecutor) ExecuteCommandWithOutputFileTimeout(timeout time.Duration, command, outfileArg string, arg ...string) (string, error)
- func (e *TranslateCommandExecutor) ExecuteCommandWithTimeout(timeout time.Duration, command string, arg ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitStatus ¶
Types ¶
type CommandExecutor ¶
type CommandExecutor struct { }
CommandExecutor is the type of the Executor
func (*CommandExecutor) ExecuteCommand ¶
func (c *CommandExecutor) ExecuteCommand(command string, arg ...string) error
ExecuteCommand starts a process and wait for its completion
func (*CommandExecutor) ExecuteCommandWithCombinedOutput ¶
func (*CommandExecutor) ExecuteCommandWithCombinedOutput(command string, arg ...string) (string, error)
ExecuteCommandWithCombinedOutput executes a command with combined output
func (*CommandExecutor) ExecuteCommandWithEnv ¶
func (*CommandExecutor) ExecuteCommandWithEnv(env []string, command string, arg ...string) error
ExecuteCommandWithEnv starts a process with env variables and wait for its completion
func (*CommandExecutor) ExecuteCommandWithOutput ¶
func (*CommandExecutor) ExecuteCommandWithOutput(command string, arg ...string) (string, error)
ExecuteCommandWithOutput executes a command with output
func (*CommandExecutor) ExecuteCommandWithOutputFile ¶
func (*CommandExecutor) ExecuteCommandWithOutputFile(command, outfileArg string, arg ...string) (string, error)
ExecuteCommandWithOutputFile executes a command with output on a file #nosec G307 Calling defer to close the file without checking the error return is not a risk for a simple file open and close
func (*CommandExecutor) ExecuteCommandWithOutputFileTimeout ¶
func (*CommandExecutor) ExecuteCommandWithOutputFileTimeout(timeout time.Duration, command, outfileArg string, arg ...string) (string, error)
ExecuteCommandWithOutputFileTimeout Same as ExecuteCommandWithOutputFile but with a timeout limit. #nosec G307 Calling defer to close the file without checking the error return is not a risk for a simple file open and close
func (*CommandExecutor) ExecuteCommandWithTimeout ¶
func (*CommandExecutor) ExecuteCommandWithTimeout(timeout time.Duration, command string, arg ...string) (string, error)
ExecuteCommandWithTimeout starts a process and wait for its completion with timeout.
type Executor ¶
type Executor interface { ExecuteCommand(command string, arg ...string) error ExecuteCommandWithEnv(env []string, command string, arg ...string) error ExecuteCommandWithOutput(command string, arg ...string) (string, error) ExecuteCommandWithCombinedOutput(command string, arg ...string) (string, error) ExecuteCommandWithOutputFile(command, outfileArg string, arg ...string) (string, error) ExecuteCommandWithOutputFileTimeout(timeout time.Duration, command, outfileArg string, arg ...string) (string, error) ExecuteCommandWithTimeout(timeout time.Duration, command string, arg ...string) (string, error) }
Executor is the main interface for all the exec commands
type TranslateCommandExecutor ¶
type TranslateCommandExecutor struct { // Executor is probably a exec.CommandExecutor that will run the translated commands Executor Executor // Translator translates every command before running it Translator func(command string, arg ...string) (string, []string) }
TranslateCommandExecutor is an exec.Executor that translates every command before executing it This is useful to run the commands in a job with `kubectl run ...` when running the operator outside of Kubernetes and need to run tools that require running inside the cluster.
func (*TranslateCommandExecutor) ExecuteCommand ¶
func (e *TranslateCommandExecutor) ExecuteCommand(command string, arg ...string) error
ExecuteCommand starts a process and wait for its completion
func (*TranslateCommandExecutor) ExecuteCommandWithCombinedOutput ¶
func (e *TranslateCommandExecutor) ExecuteCommandWithCombinedOutput(command string, arg ...string) (string, error)
ExecuteCommandWithCombinedOutput starts a process and returns its stdout and stderr combined.
func (*TranslateCommandExecutor) ExecuteCommandWithEnv ¶
func (e *TranslateCommandExecutor) ExecuteCommandWithEnv(env []string, command string, arg ...string) error
ExecuteCommandWithEnv starts a process with an env variable and wait for its completion
func (*TranslateCommandExecutor) ExecuteCommandWithOutput ¶
func (e *TranslateCommandExecutor) ExecuteCommandWithOutput(command string, arg ...string) (string, error)
ExecuteCommandWithOutput starts a process and wait for its completion
func (*TranslateCommandExecutor) ExecuteCommandWithOutputFile ¶
func (e *TranslateCommandExecutor) ExecuteCommandWithOutputFile(command, outfileArg string, arg ...string) (string, error)
ExecuteCommandWithOutputFile starts a process and saves output to file
func (*TranslateCommandExecutor) ExecuteCommandWithOutputFileTimeout ¶
func (e *TranslateCommandExecutor) ExecuteCommandWithOutputFileTimeout( timeout time.Duration, command, outfileArg string, arg ...string) (string, error)
ExecuteCommandWithOutputFileTimeout is the same as ExecuteCommandWithOutputFile but with a timeout limit.
func (*TranslateCommandExecutor) ExecuteCommandWithTimeout ¶
func (e *TranslateCommandExecutor) ExecuteCommandWithTimeout(timeout time.Duration, command string, arg ...string) (string, error)
ExecuteCommandWithTimeout starts a process and wait for its completion with timeout.