Documentation
¶
Overview ¶
Package exec provides command execution utilities.
Index ¶
- type CmdResult
- type Exec
- func (e *Exec) RunCmd(name string, args []string) (string, error)
- func (e *Exec) RunCmdFull(name string, args []string, cwd string, timeout int) (*CmdResult, error)
- func (e *Exec) RunCmdImpl(name string, args []string, cwd string) (string, error)
- func (e *Exec) RunCmdInDir(name string, args []string, cwd string) (string, error)
- type Manager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdResult ¶
type CmdResult struct {
// Stdout contains the standard output of the command.
Stdout string
// Stderr contains the standard error output of the command.
Stderr string
// ExitCode is the exit code of the command.
ExitCode int
// DurationMs is the execution time in milliseconds.
DurationMs int64
}
CmdResult contains the full result of a command execution with separate stdout and stderr streams.
type Exec ¶
type Exec struct {
// contains filtered or unexported fields
}
Exec disk implementation.
func (*Exec) RunCmd ¶
RunCmd executes the provided command with arguments, using the current working directory.
func (*Exec) RunCmdFull ¶
func (e *Exec) RunCmdFull( name string, args []string, cwd string, timeout int, ) (*CmdResult, error)
RunCmdFull executes the provided command with separate stdout and stderr capture, an optional working directory, and a timeout in seconds. A timeout of 0 defaults to 30 seconds.
func (*Exec) RunCmdImpl ¶
RunCmdImpl executes the provided command with the specified arguments and an optional working directory. It captures and logs the combined output (stdout and stderr) of the command.
type Manager ¶
type Manager interface {
// RunCmd executes the provided command with arguments, using the current
// working directory.
RunCmd(
name string,
args []string,
) (string, error)
// RunCmdFull executes a command with separate stdout/stderr capture,
// an optional working directory, and a timeout in seconds.
RunCmdFull(
name string,
args []string,
cwd string,
timeout int,
) (*CmdResult, error)
}
Manager manager responsible for exec operations.