Documentation ¶
Overview ¶
shellexec provide functions for executing any program or script. It allow to retrieve stdout, stderr and error code.
Index ¶
- Constants
- Variables
- type ErrorCode
- type Options
- func (option Options) WithArgs(args ...string) Options
- func (option Options) WithEnv(env ...string) Options
- func (option Options) WithPath(path string) Options
- func (option Options) WithProgram(program string) Options
- func (option Options) WithStdin(stdin io.Reader) Options
- func (option Options) WithTimeout(timeout time.Duration) Options
- type Output
Constants ¶
View Source
const ( // ErrorCode values ErrorCodeUnknown = ErrorCode(100) ErrorCodeReadStdout = ErrorCode(101) ErrorCodeReadStderr = ErrorCode(102) ErrorCodeTimeout = ErrorCode(103) ErrorCodeKillFailed = ErrorCode(104) )
View Source
const ( // DefaultTimeout for exiting DefaultTimeout = 5 * time.Second MinimumTimeout = 100 * time.Millisecond )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ErrorCode ¶
type ErrorCode int
ErrorCode type
func ExitCodeFromError ¶
ExitCodeFromError return ErroCode from error
type Options ¶
type Options struct { Timeout time.Duration // Timeout execution Program string // program name Path string // program path (optional) Env []string // Program env (optional) Stdin io.Reader // Program Stdin (optional) Args []string // Program arguments (optional) }
Options for Execute
func (Options) WithProgram ¶
WithProgram add program to options
Click to show internal directories.
Click to hide internal directories.