Documentation
¶
Overview ¶
Package exec provides helpers for running system commands.
Index ¶
- func Exec(command string, args ...string) error
- func Has(command string) bool
- func Run(command string, args ...string) error
- func RunCode(command string, args ...string) int
- func RunQuiet(command string, args ...string) error
- func RunSilent(command string, args ...string) error
- func Sh(command string) string
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶ added in v0.1.5
Exec replaces the current process with the given command. On success it never returns; the calling process is replaced entirely. Returns an error only if the exec syscall itself fails.
func Run ¶
Run executes a command with inherited stdio. Returns an error if the exit code is non-zero.
func RunCode ¶
RunCode executes a command with inherited stdio and returns the exit code. Use this when the caller needs to branch on specific exit codes.
func RunQuiet ¶ added in v0.1.7
RunQuiet executes a command, discarding stdout but capturing stderr. If the command fails, the returned error includes the stderr output so you know why it failed.
Types ¶
type Result ¶
Result holds the output of a captured command.
func RunCapture ¶
RunCapture executes a command and captures stdout and stderr.
func RunCaptureWithStdin ¶ added in v0.1.7
RunCaptureWithStdin executes a command, writes data to its stdin, and captures stdout/stderr. Useful for commands that require interactive input (like hashing passwords) without exposing the input in the process list (ps aux).