executil

package
v1.5.46 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: MIT Imports: 9 Imported by: 17

Documentation

Overview

Utilities that make executing commands on the local system a little bit easier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	*exec.Cmd
	MonitorInterval time.Duration
	OnStart         CommandStatusFunc
	OnMonitor       CommandStatusFunc
	OnComplete      CommandStatusFunc
	OnSuccess       CommandStatusFunc
	OnError         CommandStatusFunc
	// contains filtered or unexported fields
}

func Command

func Command(name string, arg ...string) *Cmd

func CommandContext

func CommandContext(ctx context.Context, name string, arg ...string) *Cmd

func Wrap

func Wrap(cmd *exec.Cmd) *Cmd

func (*Cmd) CombinedOutput

func (self *Cmd) CombinedOutput() ([]byte, error)

func (*Cmd) Output

func (self *Cmd) Output() ([]byte, error)

func (*Cmd) Run

func (self *Cmd) Run() error

func (*Cmd) Start

func (self *Cmd) Start() error

func (*Cmd) Status

func (self *Cmd) Status() Status

Return the current status of the process.

func (*Cmd) WaitStatus

func (self *Cmd) WaitStatus() Status

Wait for the process to complete, then return the last status. Process must have been started using the Start() function.

type CommandStatusFunc

type CommandStatusFunc func(Status)

type Status

type Status struct {
	StartedAt  time.Time
	StoppedAt  time.Time
	Running    bool
	Successful bool
	ExitCode   int
	Error      error
	PID        int
}

func (Status) String

func (self Status) String() string

func (Status) Took

func (self Status) Took() time.Duration

Jump to

Keyboard shortcuts

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