Documentation
¶
Overview ¶
Package timeout is for handling timeout invocation of external command
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExitStatus ¶
ExitStatus stores exit information of the command
func (*ExitStatus) GetChildExitCode ¶
func (ex *ExitStatus) GetChildExitCode() int
GetChildExitCode gets the exit code of the Cmd itself
func (*ExitStatus) GetExitCode ¶
func (ex *ExitStatus) GetExitCode() int
GetExitCode gets the exit code for command line tools
func (*ExitStatus) IsCanceled ¶ added in v0.3.0
func (ex *ExitStatus) IsCanceled() bool
IsCanceled return if the command canceled by context or not
func (*ExitStatus) IsKilled ¶
func (ex *ExitStatus) IsKilled() bool
IsKilled returns the command is killed or not
func (*ExitStatus) IsTimedOut ¶
func (ex *ExitStatus) IsTimedOut() bool
IsTimedOut returns the command timed out or not
type Timeout ¶
type Timeout struct { Duration time.Duration KillAfter time.Duration Signal os.Signal Foreground bool Cmd *exec.Cmd KillAfterCancel time.Duration }
Timeout is main struct of timeout package
func (*Timeout) Run ¶
func (tio *Timeout) Run() (*ExitStatus, string, string, error)
Run is synchronous interface of executing command and returning information
func (*Timeout) RunCommand ¶
func (tio *Timeout) RunCommand() (<-chan *ExitStatus, error)
RunCommand is executing the command and handling timeout. This is primitive interface of Timeout
func (*Timeout) RunContext ¶ added in v0.3.0
func (tio *Timeout) RunContext(ctx context.Context) (*ExitStatus, error)
RunContext runs command with context