Documentation ¶
Index ¶
- Variables
- func Add(desc string, cmd *exec.Cmd) int64
- func Exec(desc, cmdName string, args ...string) (string, string, error)
- func ExecDir(timeout time.Duration, dir, desc, cmdName string, args ...string) (string, string, error)
- func ExecDirEnv(timeout time.Duration, dir, desc string, env []string, cmdName string, ...) (string, string, error)
- func ExecTimeout(timeout time.Duration, desc, cmdName string, args ...string) (string, string, error)
- func Kill(pid int64) error
- func Remove(pid int64)
- type Process
Constants ¶
This section is empty.
Variables ¶
var ( // ErrExecTimeout represent a timeout error ErrExecTimeout = errors.New("Process execution timeout") // DefaultTimeout is the timeout used by Exec* family // of function when timeout parameter is omitted or // passed as -1 // NOTE: could be custom in config file for default. DefaultTimeout = 60 * time.Second )
var (
Processes []*Process
)
List of existing processes.
Functions ¶
func Exec ¶
Exec runs a command and waits for its completion up to DefaultTimeout. Returns its complete stdout and stderr outputs and an error, if any (including timeout)
func ExecDir ¶
func ExecDir(timeout time.Duration, dir, desc, cmdName string, args ...string) (string, string, error)
ExecDir works exactly like ExecDirEnv except no environment variable is provided.
func ExecDirEnv ¶ added in v1.0.0
func ExecDirEnv(timeout time.Duration, dir, desc string, env []string, cmdName string, args ...string) (string, string, error)
ExecDirEnv runs a command in given path and environment variables, and waits for its completion up to the given timeout (or DefaultTimeout if -1 is given). Returns its complete stdout and stderr outputs and an error, if any (including timeout)
func ExecTimeout ¶
func ExecTimeout(timeout time.Duration, desc, cmdName string, args ...string) (string, string, error)
ExecTimeout runs a command and waits for its completion up to the given timeout (or DefaultTimeout if -1 is given). Returns its complete stdout and stderr outputs and an error, if any (including timeout)