Documentation
¶
Overview ¶
Package shell handles shell command execution with timeout support.
Index ¶
Constants ¶
View Source
const DefaultTimeout = 30
DefaultTimeout is the default command timeout in seconds.
Variables ¶
This section is empty.
Functions ¶
func DetectShell ¶
DetectShell finds an available Unix shell in PATH. Prefers bash, falls back to sh. Windows shells (cmd.exe, PowerShell) are not supported.
func IsShellAvailable ¶
IsShellAvailable checks if a specific shell is available.
Types ¶
type RunResult ¶
type RunResult struct {
// Stdout is the standard output of the command.
Stdout string
// Stderr is the standard error of the command.
Stderr string
// ExitCode is the exit code of the command.
ExitCode int
// TimedOut indicates whether the command timed out.
TimedOut bool
}
RunResult contains the result of a shell command execution.
type Runner ¶
type Runner struct {
// Shell is the shell command to use (e.g., "bash -c", "sh -c").
// If empty, auto-detection is used.
Shell string
// Timeout is the default timeout in seconds for commands.
// If 0, the DefaultTimeout constant is used.
Timeout int
}
Runner executes shell commands with timeout support.
func NewRunner ¶
func NewRunner() *Runner
NewRunner creates a new shell runner with auto-detected shell.
Click to show internal directories.
Click to hide internal directories.