exec

package
v0.0.0-...-a79519d Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(times int, interval time.Duration, f func() error) error

Retry will run function with times, if err is nil, it will return nil, if over times, it will return last error.

func Run

func Run(timeout time.Duration, bin string, args ...string) (int, string, string, error)

Run returns running command result with timeout, returns are command exit code, stdout iostream, stderr iostream, error.

func RunWithRetry

func RunWithRetry(times int, interval, timeout time.Duration, bin string, args ...string) (int, string, string, error)

RunWithRetry returns running command with "times" retries, must keep exit is 0 when execute success, returns are command exit code, stdout iostream, stderr iostream, error.

Types

type Process

type Process struct {
	// Binary's absolute path.
	Path string

	// Arguments use to execute binary.
	Args []string

	// Output represents a file that the stdio and stderr will write.
	Output string

	sync.Mutex
	// contains filtered or unexported fields
}

Process represents a program will be execute.

func (*Process) Start

func (p *Process) Start() error

Start start process.

func (*Process) Stop

func (p *Process) Stop() error

Stop kill the running process.

type Processes

type Processes []*Process

Processes is slice of Process type.

func (Processes) RunAll

func (ps Processes) RunAll() error

RunAll execute the all commands.

func (Processes) StopAll

func (ps Processes) StopAll() error

StopAll stop the all running processes.

Jump to

Keyboard shortcuts

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