shell

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StreamOutput sets streaming of output instead of buffering it when running gocmd.Cmd.
	StreamOutput gocmd.Options = gocmd.Options{
		Buffered:  false,
		Streaming: true,
	}

	// BufferAndStreamOutput sets buffering and streaming of output when running gocmd.Cmd
	// Buffering lets easy inspection of outputs in tests through inspecting gocmd.Cmd.Status.Stdout/err slices.
	BufferAndStreamOutput = gocmd.Options{
		Buffered:  true,
		Streaming: true,
	}
)

Functions

func BinaryExists

func BinaryExists(binName, hint string) bool

BinaryExists ensures that binary with given name (binName) is available on the PATH. hint lets you customize the error message.

func CurrentDir

func CurrentDir() string

CurrentDir returns current directory from where binary is executed.

func RedirectStreams

func RedirectStreams(src *gocmd.Cmd, stdoutDest, stderrDest io.Writer)

RedirectStreams redirects Stdout and Stderr of the gocmd.Cmd process to passed io.Writers.

func ShutdownHookForChildCommand added in v0.0.4

func ShutdownHookForChildCommand(cmd *gocmd.Cmd)

ShutdownHookForChildCommand will wait for SIGTERM signal and stop the cmd unless done receiving channel passed to it receives status or is closed.

func Start

func Start(cmd *gocmd.Cmd, done chan gocmd.Status)

Start starts new process (gocmd) and wait until it's done. Status struct is then propagated back to done channel passed as argument.

Types

This section is empty.

Jump to

Keyboard shortcuts

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