Help us shape the future of Go! Take the 2026 Go Developer Survey

exec

package
v0.13.6 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 10 Imported by: 112

Documentation

Index

Constants

This section is empty.

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 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