cosmostests

package
v0.7.9-rc11 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteT

func ExecuteT(t *testing.T, cmd, input string, envs []string) (stdout, stderr string)

ExecuteT executes the command, pipes any input to STDIN and return STDOUT, logging STDOUT/STDERR to t.

Types

type Process

type Process struct {
	ExecPath   string
	Args       []string
	EnvVars    []string
	Pid        int
	StartTime  time.Time
	EndTime    time.Time
	Cmd        *exec.Cmd        `json:"-"`
	ExitState  *os.ProcessState `json:"-"`
	StdinPipe  io.WriteCloser   `json:"-"`
	StdoutPipe io.ReadCloser    `json:"-"`
	StderrPipe io.ReadCloser    `json:"-"`
}

execution process

func CreateProcess

func CreateProcess(dir string, name string, args []string, envs []string) (*Process, error)

Same as StartProcess but doesn't start the process

func GoExecuteT

func GoExecuteT(t *testing.T, cmd string, envs []string) (proc *Process)

Execute the command, launch goroutines to log stdout/err to t. Caller should wait for .Wait() or .Stop() to terminate.

func GoExecuteTWithStdout

func GoExecuteTWithStdout(t *testing.T, cmd string) (proc *Process)

Same as GoExecuteT but spawns a go routine to ReadAll off stdout.

func StartProcess

func StartProcess(dir string, name string, args []string, envs []string) (*Process, error)

dir: The working directory. If "", os.Getwd() is used. name: Command name args: Args to command. (should not include name)

func (*Process) ReadAll

func (proc *Process) ReadAll() (stdout []byte, stderr []byte, err error)

ReadAll calls ioutil.ReadAll on the StdoutPipe and StderrPipe.

func (*Process) Stop

func (proc *Process) Stop(kill bool) error

stop the process

func (*Process) Wait

func (proc *Process) Wait()

wait for the process

Jump to

Keyboard shortcuts

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