Documentation
¶
Index ¶
- type CommandRunner
- type CommandsRunner
- func (r *CommandsRunner) CombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (r *CommandsRunner) Run(ctx context.Context, cmd string, args ...string) error
- func (r *CommandsRunner) RunAndTrimmedOutput(ctx context.Context, cmd string, args ...string) (string, error)
- func (r *CommandsRunner) RunWithOutput(ctx context.Context, cmd string, args ...string) ([]byte, error)
- func (r *CommandsRunner) RunWithOutputS(ctx context.Context, cmd string, args ...string) ([]byte, error)
- func (r *CommandsRunner) RunWithOutputSNoErrLog(ctx context.Context, cmd string, args ...string) ([]byte, error)
- func (r *CommandsRunner) RunWithS(ctx context.Context, cmd string, args ...string) error
- func (r *CommandsRunner) SetCommand(ctx context.Context, cmd string, args ...string) *exec.Cmd
- func (r *CommandsRunner) SetCommandWithS(ctx context.Context, cmd string, args ...string) *exec.Cmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandRunner ¶
type CommandRunner interface {
SetCommand(cmd string, args ...string) *exec.Cmd
SetCommandWithS(cmd string, args ...string) *exec.Cmd
CombinedOutput(cmd *exec.Cmd) ([]byte, error)
Run(cmd string, args ...string) error
RunWithOutput(cmd string, args ...string) ([]byte, error)
RunWithS(cmd string, args ...string) error
RunWithOutputS(cmd string, args ...string) ([]byte, error)
RunAndTrimmedOutput(cmd string, args ...string) (string, error)
}
type CommandsRunner ¶
type CommandsRunner struct {
// contains filtered or unexported fields
}
func NewCommandsRunner ¶
func NewCommandsRunner() *CommandsRunner
func (*CommandsRunner) CombinedOutput ¶
func (r *CommandsRunner) CombinedOutput(cmd *exec.Cmd) ([]byte, error)
func (*CommandsRunner) RunAndTrimmedOutput ¶
func (*CommandsRunner) RunWithOutput ¶
func (*CommandsRunner) RunWithOutputS ¶
func (*CommandsRunner) RunWithOutputSNoErrLog ¶
func (r *CommandsRunner) RunWithOutputSNoErrLog(ctx context.Context, cmd string, args ...string) ([]byte, error)
RunWithOutputSNoErrLog runs command with sudo and returns output without logging errors Useful for commands like "systemctl status" where non-zero exit codes are expected
func (*CommandsRunner) SetCommand ¶
func (*CommandsRunner) SetCommandWithS ¶
Click to show internal directories.
Click to hide internal directories.