execx

package
v0.30.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug              = false  //nolint:gochecknoglobals // This variable is shared between all the command instances.
	LogFile            *os.File //nolint:gochecknoglobals // This variable is shared between all the command instances.
	NoTTY              = false  //nolint:gochecknoglobals // This variable is shared between all the command instances.
	ErrCmdFailed       = errors.New("command failed")
	ErrCmdTimeout      = errors.New("command timed out")
	ErrCastingToBuffer = errors.New("error casting stdout to bytes.Buffer")
)

Functions

func CombinedOutput

func CombinedOutput(cmd *Cmd) (string, error)

func NewErrCmdFailed

func NewErrCmdFailed(name string, args []string, err error, res *CmdLog) error

Types

type Cmd

type Cmd struct {
	*exec.Cmd
	Log       *CmdLog
	Sensitive bool
}

func NewCmd

func NewCmd(name string, opts CmdOptions) *Cmd

func (*Cmd) Run

func (c *Cmd) Run() error

func (*Cmd) RunWithTimeout

func (c *Cmd) RunWithTimeout(timeout time.Duration) error

func (*Cmd) Stop

func (c *Cmd) Stop() error

type CmdLog

type CmdLog struct {
	Out *bytes.Buffer
	Err *bytes.Buffer
}

func (CmdLog) String

func (c CmdLog) String() string

type CmdOptions

type CmdOptions struct {
	Args      []string
	Err       io.Writer
	Executor  Executor
	Out       io.Writer
	Sensitive bool
	WorkDir   string
}

type Executor

type Executor interface {
	Command(name string, arg ...string) *exec.Cmd
}

type FakeExecutor

type FakeExecutor struct {
	// contains filtered or unexported fields
}

func NewFakeExecutor

func NewFakeExecutor(testHelperProcessFn string) *FakeExecutor

func (*FakeExecutor) Command

func (fe *FakeExecutor) Command(name string, arg ...string) *exec.Cmd

type StdExecutor

type StdExecutor struct{}

func NewStdExecutor

func NewStdExecutor() *StdExecutor

func (*StdExecutor) Command

func (*StdExecutor) Command(name string, arg ...string) *exec.Cmd

Jump to

Keyboard shortcuts

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