exec

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// Run is like Output, but without the stdout
	Run() error

	// Output executes the command, and returns the stdout
	Output() ([]byte, error)

	// SetDir sets the command's working directory
	SetDir(dir string)

	// SetEnv sets the environment variables for the command's execution environment
	SetEnv(env map[string]string)

	SetStdin(in io.Reader)
	SetStdout(out io.Writer)
	SetStderr(out io.Writer)
}

type Commander

type Commander interface {
	// Command returns a Cmd instance which can be used to run a single command.
	Command(logger logr.Logger, executable string, args ...string) Command

	// CommandContext returns a Cmd instance which can be used to run a single command.
	//
	// The provided context is used to kill the process if the context becomes done
	// before the command completes on its own. For example, a timeout can be set in
	// the context.
	CommandContext(ctx context.Context, logger logr.Logger, executable string, args ...string) Command
}

Commander is an interface for creating Commands it can be used for mocking out os command executions for testing

func New

func New() Commander

Jump to

Keyboard shortcuts

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