childminder

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustResolve

func MustResolve(wd string) string

MustResolve returns an absolute path or panics if the underlying sys call fails

Types

type ChildMinder

type ChildMinder struct {
	// Logger is the logger the simulator will use
	Logger *logrus.Logger
	// The working directory of the chlid process
	WorkingDir string
	// Environment is the variables to append to the parent's environment when
	// running the child process
	Environment []string
	// CommandPath is the path to the command to run
	CommandPath string
	// CommmandArguments are the arguments to supply to the command
	CommandArguments []string
}

ChildMinder represents a child process to be managed

func NewChildMinder

func NewChildMinder(
	logger *logrus.Logger,
	wd string,
	env []string,
	cmd string,
	args ...string) *ChildMinder

NewChildMinder creates an instance of a ChildMinder

func (*ChildMinder) ForwardStdErr

func (cm *ChildMinder) ForwardStdErr(stderrPipe io.Reader, wg *sync.WaitGroup)

ForwardStdErr takes a child process's stderr pipe and reads it line by line passing the output through the ChildMinder's logger

func (*ChildMinder) ForwardStdOut

func (cm *ChildMinder) ForwardStdOut(stdoutPipe io.Reader, wg *sync.WaitGroup)

ForwardStdOut takes a child process's stdout pipe and reads it line by line passing the output through the ChildMinder's logger

func (*ChildMinder) Run

func (cm *ChildMinder) Run() (*string, error)

Run runs a child process and returns its buffer stdout. Run also tees the output to stdout of this process, `env` will be appended to the current environment. `wd` is the working directory for the child

func (*ChildMinder) RunSilently

func (cm *ChildMinder) RunSilently() (*string, *string, error)

RunSilently runs a sub command silently

Jump to

Keyboard shortcuts

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