exec2

package
v0.0.0-...-a16ed4d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	// Args is a list of arguments to provide to the process.
	Args []string
	// CombinedOutputLogFile is the path to a file where the process's
	// stdout and stderr should be logged.
	CombinedOutputLogFile string
	// Command is the path to the process that you want to run
	Command string
	// Environment variables to use. If empty, set to current process's env.
	Env []string
	// ExpectedSuccessCodes is a list of exit codes the process will return if
	// it completes successfully.
	ExpectedSuccessCodes []int
	// WorkingDir is the working directory of the process.
	WorkingDir string
}

Cmd is the configuration struct for a process.

type Process

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

Process is a process that has either run or is going to be run.

func NewProcess

func NewProcess(config Cmd) *Process

NewProcess creates a new process, given the configuration. It does not start the process.

func (*Process) ExitCode

func (p *Process) ExitCode() int

ExitCode returns the exit code for the process. If the process has not yet run or exited, the result will be 0.

func (*Process) Exited

func (p *Process) Exited() bool

Exited returns whether or not the process has run and exited.

func (*Process) Process

func (p *Process) Process() *os.Process

Process returns the Process field of underlying exec command This allows us to interact with it, i.e. for sending signals

func (*Process) Run

func (p *Process) Run() error

Run runs the process.

func (*Process) Runtime

func (p *Process) Runtime() time.Duration

Runtime returns the time.Duration the process took to run.

func (*Process) Stderr

func (p *Process) Stderr() *bytes.Buffer

Stderr returns the contents of the process's stderr.

func (*Process) Stdout

func (p *Process) Stdout() *bytes.Buffer

Stdout returns the contents of the process's stdout.

func (*Process) Success

func (p *Process) Success() bool

Success returns whether or not the process has exited and if it exited with a success code.

Jump to

Keyboard shortcuts

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