Documentation
¶
Index ¶
- func CommandInstalled(command string) bool
- func CommandInstalledE(command string) error
- func GetExitCodeForRunCommandError(err error) (int, error)
- func KeysStringString(m map[string]string) string
- func RunCommand(command Command) error
- func RunCommandAndGetOutput(command Command) (string, error)
- func RunCommandAndGetStdOut(command Command) (string, error)
- func RunShellCommand(command Command) error
- func RunShellCommandAndGetAndStreamOutput(command Command) (string, error)
- func RunShellCommandAndGetOutput(command Command) (string, error)
- type Command
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandInstalled ¶
Return true if the OS has the given command installed
func CommandInstalledE ¶
CommandInstalledE returns an error if command is not installed
func GetExitCodeForRunCommandError ¶
GetExitCodeForRunCommandError tries to read the exit code for the error object returned from running a shell command. This is a bit tricky to do in a way that works across platforms.
func KeysStringString ¶
func RunCommand ¶
RunCommand runs a shell command and redirects its stdout and stderr to the stdout of the atomic script itself.
func RunCommandAndGetOutput ¶
RunCommandAndGetOutput runs a shell command and returns its stdout and stderr as a string. The stdout and stderr of that command will also be printed to the stdout and stderr of this Go program to make debugging easier.
func RunCommandAndGetStdOut ¶
RunCommandAndGetStdOut runs a shell command and returns solely its stdout (but not stderr) as a string. The stdout and stderr of that command will also be printed to the stdout and stderr of this Go program to make debugging easier.
func RunShellCommand ¶
Run the specified shell command with the specified arguments. Connect the command's stdin, stdout, and stderr to the currently running app.
func RunShellCommandAndGetAndStreamOutput ¶
Run the specified shell command with the specified arguments. Return its stdout and stderr as a string and also stream stdout and stderr to the OS stdout/stderr
func RunShellCommandAndGetOutput ¶
Run the specified shell command with the specified arguments. Return its stdout and stderr as a string
Types ¶
type Command ¶
type Command struct {
Command string // The command to run
Args []string // The args to pass to the command
WorkingDir string // The working directory
Env map[string]string // Additional environment variables to set
OutputMaxLineSize int // The max line size of stdout and stderr (in bytes)
Logger *logrus.Entry
NonInteractive bool
SensitiveArgs bool // If true, will not log the arguments to the command
}
Command is a simpler struct for defining commands than Go's built-in Cmd.