cmdrunner

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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) Run

func (r *CommandsRunner) Run(ctx context.Context, cmd string, args ...string) error

func (*CommandsRunner) RunAndTrimmedOutput

func (r *CommandsRunner) RunAndTrimmedOutput(ctx context.Context, cmd string, args ...string) (string, error)

func (*CommandsRunner) RunWithOutput

func (r *CommandsRunner) RunWithOutput(ctx context.Context, cmd string, args ...string) ([]byte, error)

func (*CommandsRunner) RunWithOutputS

func (r *CommandsRunner) RunWithOutputS(ctx context.Context, cmd string, args ...string) ([]byte, error)

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) RunWithS

func (r *CommandsRunner) RunWithS(ctx context.Context, cmd string, args ...string) error

func (*CommandsRunner) SetCommand

func (r *CommandsRunner) SetCommand(ctx context.Context, cmd string, args ...string) *exec.Cmd

func (*CommandsRunner) SetCommandWithS

func (r *CommandsRunner) SetCommandWithS(ctx context.Context, cmd string, args ...string) *exec.Cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL