exec

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultTimeout = 10 * time.Minute

Variables

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

Functions

func Command

func Command(name string, args ...string) *exec.Cmd

func Redact

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

func Run

func Run(cmd *exec.Cmd) (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