Documentation ¶
Index ¶
- Variables
- func Redact(items []string) func(text string) string
- func RunCommand(name string, opts CmdOpts, arg ...string) (string, error)
- func RunCommandExt(cmd *exec.Cmd, opts CmdOpts) (string, error)
- func WaitPID(pid int, opts ...WaitPIDOpts) error
- type CmdError
- type CmdOpts
- type TimeoutBehavior
- type WaitPIDOpts
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, TimeoutBehavior: TimeoutBehavior{syscall.SIGKILL, false}, }
Functions ¶
func RunCommandExt ¶
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 CmdOpts ¶
type CmdOpts struct { // Timeout determines how long to wait for the command to exit Timeout time.Duration // Redactor redacts tokens from the output Redactor func(text string) string // TimeoutBehavior configures what to do in case of timeout TimeoutBehavior TimeoutBehavior }
type TimeoutBehavior ¶
type TimeoutBehavior struct { // Signal determines the signal to send to the process Signal syscall.Signal // ShouldWait determines whether to wait for the command to exit once timeout is reached ShouldWait bool }
TimeoutBehavior defines behavior for when the command takes longer than the passed in timeout to exit By default, SIGKILL is sent to the process and it is not waited upon
Click to show internal directories.
Click to hide internal directories.