testexec

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StdoutDebug = DebugTo(os.Stdout)
	StderrDebug = DebugTo(os.Stderr)
)

Functions

This section is empty.

Types

type Exec

type Exec struct {
	Logf    func(string, ...interface{})
	Args    []string
	Command string
	Cwd     string
	Env     []string
	Stderr  io.Writer
	Stdout  io.Writer
	// contains filtered or unexported fields
}

func NewExec

func NewExec(command string, opts ...Opt) *Exec

func (*Exec) BuildCmd

func (e *Exec) BuildCmd(ctx context.Context) *exec.Cmd

func (*Exec) Run

func (e *Exec) Run() error

type Opt

type Opt func(*Exec) *Exec

func DebugTo

func DebugTo(w io.Writer) Opt

func InDir

func InDir(dir string) Opt

func LogFunc

func LogFunc(logf func(string, ...interface{})) Opt

func StderrTo

func StderrTo(stderr io.Writer) Opt

func StdoutTo

func StdoutTo(stdout io.Writer) Opt

func WithArgs

func WithArgs(args ...string) Opt

func WithDryRun

func WithDryRun() Opt

func WithEnv

func WithEnv(env []string) Opt

func WithEnvs

func WithEnvs(envs ...string) Opt

func WithMapEnv

func WithMapEnv(env map[string]string) Opt

Jump to

Keyboard shortcuts

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