exec

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCmdOpts = CmdOpts{
	Timeout:  time.Duration(0),
	Redactor: Unredacted,
}
View Source
var ErrWaitPIDTimeout = fmt.Errorf("Timed out waiting for PID to complete")
View Source
var Unredacted = Redact(nil)

Functions

func Redact

func Redact(items []string) func(text string) string

func RunCommand

func RunCommand(name string, opts CmdOpts, arg ...string) (string, error)

func RunCommandExt

func RunCommandExt(cmd *exec.Cmd, opts CmdOpts) (string, error)

RunCommandExt is a convenience function to run/log a command and return/log stderr in an error upon failure.

func WaitPID

func WaitPID(pid int, opts ...WaitPIDOpts) error

WaitPID waits for a non-child process id to exit

Types

type CmdError

type CmdError struct {
	Args   string
	Stderr string
	Cause  error
}

func (*CmdError) Error

func (ce *CmdError) Error() string

func (*CmdError) String

func (ce *CmdError) String() string

type CmdOpts

type CmdOpts struct {
	Timeout  time.Duration
	Redactor func(text string) string
}

type WaitPIDOpts

type WaitPIDOpts struct {
	PollInterval time.Duration
	Timeout      time.Duration
}

WaitPIDOpts are options to WaitPID

Jump to

Keyboard shortcuts

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