runner

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExitCode

func GetExitCode(err error) (int, error)

GetExitCode attempts to unrap an exit code into something that gives more context into why the runner exited

Types

type Runner

type Runner struct {
	Owner      string
	ID         int64
	BaseDir    string
	StdoutFile string
	StderrFile string
	Program    string
	Args       []string
	FinChan    chan bool
	Output     chan string
	Errors     chan error
	EnvVars    map[string]string
}

Runner is a command executor with streaming output over channels

func NewRunner

func NewRunner(owner, basedir string) *Runner

NewRunner returns a new empty runner

func (*Runner) ExecuteCommand

func (r *Runner) ExecuteCommand(command string, args ...string)

ExecuteCommand executes the command in a sub process, streaming output over the Runner's output channels.

type SignalsForwarder

type SignalsForwarder chan os.Signal

SignalsForwarder passes signals between the current program and the runners sub processes

func NewSignalsForwarder

func NewSignalsForwarder(signals []os.Signal, c *exec.Cmd, cmdChannel chan error) SignalsForwarder

NewSignalsForwarder creates a new signals forwarder for the runner

func (*SignalsForwarder) Close

func (s *SignalsForwarder) Close() error

Close closes the SignalForwardering goroutine

Jump to

Keyboard shortcuts

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