Documentation
¶
Index ¶
Constants ¶
const DefaultTimeout = 120 * time.Second
DefaultTimeout is the maximum wall-clock time a single command may run.
const MaxOutputBytes = 1 << 20 // 1 MiB
MaxOutputBytes caps captured stdout/stderr per command.
Variables ¶
This section is empty.
Functions ¶
func Command ¶
Command wraps exec.Command for internal use where arguments are built programmatically from trusted sources (config values, constants). Centralises the gosec G204 suppression to a single location.
func CommandContext ¶
CommandContext wraps exec.CommandContext for internal use where arguments are built programmatically from trusted sources.
Types ¶
type Result ¶
type Result struct {
Command string `json:"command"`
ExitCode int `json:"exit_code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
}
Result holds the outcome of a single shell command.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes shell commands scoped to a specific project root directory. Commands are always run with sh -c inside the configured root.
func (*Runner) Run ¶
Run executes a shell command in the project root directory. The command is validated before execution: it must not be empty, contain embedded newlines, control characters, or exceed the length limit. Commands are killed after the configured timeout (default 120s).
func (*Runner) RunUnchecked ¶
RunUnchecked executes a command without sanitization. Use only for known-safe internal commands (e.g. go mod init with a validated path).