run

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Entry contains all the state of one command run.

func (*Entry) Contains

func (e *Entry) Contains(s string) bool

Contains return true if either stdout or stderr contains the string s.

func (*Entry) ExitCode

func (e *Entry) ExitCode() int

ExitCode returns the exit status of the command.

func (*Entry) Lines

func (e *Entry) Lines() chan<- string

Lines iterates over all lines of the command output.

type Executor

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

Executor holds the context for forking a number of commands.

func (*Executor) History

func (e *Executor) History(n int) *Entry

History return the nth entry. The most recent command is at index 0.

func (*Executor) Last

func (e *Executor) Last() *Entry

Last returns the most recent Entry.

func (*Executor) RunCmd

func (e *Executor) RunCmd(cmd *exec.Cmd) (*Entry, error)

RunCmd executes a exec.Cmd

func (Executor) RunV

func (e Executor) RunV(name string, args ...string) (*Entry, error)

RunV executes a command with an optional array of arguments. RunV will wait until the spawned commands terminates before returning.

type Options

type Options struct {
	// Verbose controls if Executor should print command output to stdout and stderr.
	Verbose bool
}

Options holds configuration options for the Executor object.

type Run

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

Run is the top level API objects. It can be used to create executor, responsible for running a series of commands.

func New

func New(options Options) *Run

New creates a new run context that can be used to run successive commands.

func (*Run) NewExecutor

func (r *Run) NewExecutor() *Executor

NewExecutor creates an executor for a specific test.

Jump to

Keyboard shortcuts

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