Documentation
¶
Index ¶
- func CombinedOutput(command string, args ...string) ([]byte, error)
- func Command(cmd string, args ...string) *exec.Cmd
- func CommandContext(ctx context.Context, cmd string, args ...string) *exec.Cmd
- func GetPrependedCmd() string
- func PrependCommandsWith(prependCmd string, prependArgs ...string)
- func ResetPrependedCmd()
- type CommandRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinedOutput ¶
CombinedOutput calls CombinedOutput on the defined commandRunner, or the default implementation in the exec package if there's no commandRunner defined.
func Command ¶
Command calls Command on the defined commandRunner, or the default implementation in the exec package if there's no commandRunner defined.
func CommandContext ¶
CommandContext calls CommandContext on the defined commandRunner, or the default implementation in the exec package if there's no commandRunner defined.
func GetPrependedCmd ¶
func GetPrependedCmd() string
GetPrependedCmd returns the prepended command if one is configured, else the empty string
func PrependCommandsWith ¶
PrependCommandsWith updates the commandRunner singleton to have the configured prepended args and command.
func ResetPrependedCmd ¶
func ResetPrependedCmd()
ResetPrependedCmd resets the singleton for more reliable unit testing
Types ¶
type CommandRunner ¶
type CommandRunner interface {
Command(string, ...string) *exec.Cmd
CommandContext(context.Context, string, ...string) *exec.Cmd
CombinedOutput(string, ...string) ([]byte, error)
}
CommandRunner is an interface for executing commands. It gives the option to change the way commands are run server-wide.