Documentation
¶
Index ¶
- Variables
- func AttachStderrListener(cmd *exec.Cmd, listener OutputListener) error
- func AttachStdoutListener(cmd *exec.Cmd, listener OutputListener) error
- func Command(args []string) (*exec.Cmd, error)
- func PipeCommands(commands ...*exec.Cmd) ([]byte, error)
- func TellCommandNotToSpawnShell(cmd *exec.Cmd)
- type OutputListener
Constants ¶
This section is empty.
Variables ¶
var PrintToStderr = &printToStderr{}
PrintToStderr is an OutputListener that outputs messages to standard error
var PrintToStdout = &printToStdout{}
PrintToStdout is an OutputListener that outputs messages to standard output
Functions ¶
func AttachStderrListener ¶
func AttachStderrListener(cmd *exec.Cmd, listener OutputListener) error
AttachStderrListener adds an OutputListener to the stderr of the process
func AttachStdoutListener ¶
func AttachStdoutListener(cmd *exec.Cmd, listener OutputListener) error
AttachStdoutListener adds an OutputListener to the stdout of the process
func Command ¶
Command creates a command with the provided command line arguments. The first argument is the path to the executable, the remainder are the arguments to the command.
func PipeCommands ¶
PipeCommands executes the commands received as input by feeding the output of one to the input of the other, exactly like Unix Pipe (|). Returns the output of the final command and the eventual error.
code inspired by https://gist.github.com/tyndyll/89fbb2c2273f83a074dc
func TellCommandNotToSpawnShell ¶
TellCommandNotToSpawnShell avoids that the specified Cmd display a small command prompt while runnning on Windows. It has no effects on other OS.
Types ¶
type OutputListener ¶
type OutputListener interface {
Output(msg string)
}
OutputListener is a callback interface to receive output messages from process