executor

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor added in v0.1.0

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

Executor prepares and run a command execution

func New added in v0.1.0

func New(program string, args ...string) *Executor

New returns an *Executor that will run the program with arguments

func NewShell added in v0.1.0

func NewShell(cmdline string) *Executor

NewShell returns an *Executor that will run the command line in a shell

func (*Executor) AddOutputFilter added in v0.3.0

func (e *Executor) AddOutputFilter(substring string) *Executor

AddOutputFilter adds a substring to the list used to suppress lines printed by the command

func (*Executor) Capture added in v0.1.0

func (e *Executor) Capture() *Result

Capture executes the command and return a Result

func (*Executor) CaptureAndTrim added in v0.2.0

func (e *Executor) CaptureAndTrim() *Result

CaptureAndTrim calls Capture() and trim the blank lines

func (*Executor) Run added in v0.1.0

func (e *Executor) Run() *Result

Run executes the command and returns a Result

func (*Executor) SetCwd added in v0.1.0

func (e *Executor) SetCwd(cwd string) *Executor

SetCwd changes the current working directory the command will be run in

func (*Executor) SetEnv added in v0.2.0

func (e *Executor) SetEnv(env []string) *Executor

SetEnv changes the environment variables that will be used to run the command

func (*Executor) SetEnvVar added in v0.7.0

func (e *Executor) SetEnvVar(name, value string) *Executor

SetEnvVar sets a single variable in the environment that will be used to run the command

func (*Executor) SetOutputPrefix added in v0.3.0

func (e *Executor) SetOutputPrefix(prefix string) *Executor

SetOutputPrefix sets a prefix for each line printed by the command

type Result added in v0.8.0

type Result struct {
	Code        int    // code returned by the process
	Error       error  // error about the process launch and exit
	LaunchError error  // error about the process launch
	Output      string // command output if captured, otherwise empty
}

Result represents the result of a command execution

Jump to

Keyboard shortcuts

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