testutil

package
v1.4.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CreateFile

func CreateFile(filepath, content string) error

CreateFile create file with given content

func IsCommandAvailable

func IsCommandAvailable(name string) bool

IsCommandAvailable checks if command is available OS

func ValidateCommon

func ValidateCommon() error

ValidateCommon validates variables necessary to start process

Types

type Exec added in v1.0.0

type Exec struct {
	Logf    func(string, ...interface{})
	Args    []string
	Command string
	Cwd     string
	Env     []string
	Stderr  io.Writer
	Stdout  io.Writer
}

func NewExec added in v1.0.0

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

func (*Exec) Run added in v1.0.0

func (e *Exec) Run() error

type ExecOpt added in v1.0.0

type ExecOpt func(*Exec) *Exec

func DebugTo added in v1.0.0

func DebugTo(w io.Writer) ExecOpt

func InDir added in v1.0.0

func InDir(dir string) ExecOpt

func LogFunc added in v1.0.0

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

func StderrTo added in v1.0.0

func StderrTo(stderr io.Writer) ExecOpt

func StdoutTo added in v1.0.0

func StdoutTo(stdout io.Writer) ExecOpt

func WithArgs added in v1.0.0

func WithArgs(args ...string) ExecOpt

func WithEnv added in v1.0.0

func WithEnv(env []string) ExecOpt

func WithEnvs added in v1.0.0

func WithEnvs(envs ...string) ExecOpt

func WithMapEnv added in v1.0.0

func WithMapEnv(env map[string]string) ExecOpt

Jump to

Keyboard shortcuts

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