Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Command ¶
Command runs a command with its arguments and returns the stdout or stderr or the error.
func CommandExecWithContext ¶ added in v1.10.0
func CommandExecWithContext(ctx context.Context, command string, arguments ...string) (string, error)
CommandExecWithContext runs a command with its arguments, kills the command after context is done and returns the combined stdout, stderr or the error.
WaitDelay is set so that if child processes (e.g. the compiled binary spawned by `go run`) outlive the main process and keep its stdout/stderr pipes open, CombinedOutput will still return after the delay instead of blocking forever. This is critical on macOS where zombie process groups can hold pipes open.
func CommandWithContext ¶ added in v1.9.0
func CommandWithContext(ctx context.Context, command string, arguments ...string) (chan string, chan string, error)
CommandWithContext runs a command with its arguments in background. The provided context is used to kill the command (by calling os.Process.Kill) if the context becomes done before the command completes on its own. The return channels can be used to read stdout & stderr.
Types ¶
This section is empty.