exec

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdRunner

type CmdRunner interface {
	Run(cmd *exec.Cmd) (string, error)
}

CmdRunner is an interface to safely abstract exec.Cmd calls.

func NewExecCmdRunner

func NewExecCmdRunner() CmdRunner

type CmdRunnerFunc

type CmdRunnerFunc func(cmd *exec.Cmd) (string, error)

func (CmdRunnerFunc) Run

func (f CmdRunnerFunc) Run(cmd *exec.Cmd) (string, error)

type CommandGroup

type CommandGroup struct {
	// func run before any of the commands is executed
	PreRun func() error
	// Commands to run
	Commands []*exec.Cmd
	// TargetDir to run in
	TargetDir string
}

CommandGroup contains commands that are run one after another. As soon as one command fails the whole CommandGroup will be stopped and all other not yet executed commands are skipped.

func (*CommandGroup) Run

func (cg *CommandGroup) Run() error

func (*CommandGroup) RunWith

func (cg *CommandGroup) RunWith(runner CmdRunner) error

type ErrWithStderr

type ErrWithStderr struct {
	Wrapped error
	StdErr  []byte
	Args    []string
}

func (*ErrWithStderr) Error

func (e *ErrWithStderr) Error() string

func (*ErrWithStderr) Unwrap

func (e *ErrWithStderr) Unwrap() error

Jump to

Keyboard shortcuts

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