executils

package
v0.0.0-...-0031c6d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrintToStderr = &printToStderr{}

PrintToStderr is an OutputListener that outputs messages to standard error

View Source
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

func Command(args []string) (*exec.Cmd, error)

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

func PipeCommands(commands ...*exec.Cmd) ([]byte, error)

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

func TellCommandNotToSpawnShell(cmd *exec.Cmd)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL