timeoutcmd

package
v2.40.3 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitStatus

func ExitStatus(err error) int

ExitStatus returns the error's exit status if the error is an exec.ExitError if the error is nil it return 0 otherwise returns 1.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command controls the command run.

func New

func New(dir, name string, args ...string) Command

New creates a command model.

func (*Command) SetEnv

func (c *Command) SetEnv(env []string)

SetEnv sets the command's env list.

func (*Command) SetHangTimeout

func (c *Command) SetHangTimeout(timeout time.Duration)

SetHangTimeout sets the timeout after which the command is killed when no output is received on either stdout or stderr.

func (*Command) SetStandardIO

func (c *Command) SetStandardIO(in io.Reader, out, err io.Writer)

SetStandardIO sets the input and outputs of the command.

func (*Command) SetTimeout

func (c *Command) SetTimeout(timeout time.Duration)

SetTimeout sets the max runtime of the command.

func (*Command) Start

func (c *Command) Start() error

Start starts the command run.

type NoOutputTimeoutError

type NoOutputTimeoutError struct {
	Timeout time.Duration
}

func NewNoOutputTimeout

func NewNoOutputTimeout(timeout time.Duration) NoOutputTimeoutError

func (NoOutputTimeoutError) Error

func (e NoOutputTimeoutError) Error() string

type TimeoutError

type TimeoutError struct {
	Timeout time.Duration
}

func NewTimeoutError

func NewTimeoutError(timeout time.Duration) TimeoutError

func (TimeoutError) Error

func (e TimeoutError) Error() string

Jump to

Keyboard shortcuts

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