Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Callback ¶
func Callback(options Options, stdout, stderr func(line string)) (pid int, done chan bool, err error)
Callback runs the command defined by the Options and pipes the standard and error output streams, line by line, to their respective stdout and stderr functions.
Callback returns the `pid`, a `done` channel and any err that happened during the starting of the command. The `done` channel will receive a `true` upon the successful exiting of the command and will receive a `false` if the command exited with an error (after the `stderr` func is called with the `err.Error()` message).
Callback uses cdk.Go to run goroutines and as such is safe for use within a Go-Curses environment that needs to be able to update the UI thread with display updates
func Run ¶
Run is a wrapper around With configured with the given Options and the default os.Environ
func With ¶
With is a blocking function which runs a command with the Options given and if there is an error, looks for the last non-empty line of output to STDERR (and if that's empty, checks STDOUT) and returns that as the function `err` return value. If both STDERR and STDOUT are empty, the error message is: "exit status %d" where the `%d` is replaced with the status code.