shell

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: Apache-2.0 Imports: 10 Imported by: 170

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExitCodeForRunCommandError

func GetExitCodeForRunCommandError(err error) (int, error)

Try to read the exit code for the error object returned from running a shell command. This is a bit tricky to do in a way that works across platforms.

func RunCommand

func RunCommand(t *testing.T, command Command)

Run a shell command and redirect its stdout and stderr to the stdout of the atomic script itself

func RunCommandAndGetOutput

func RunCommandAndGetOutput(t *testing.T, command Command) string

Run a shell command and return its stdout and stderr as a string. The stdout and stderr of that command will also be printed to the stdout and stderr of this Go program to make debugging easier.

func RunCommandAndGetOutputE

func RunCommandAndGetOutputE(t *testing.T, command Command) (string, error)

Run a shell command and return its stdout and stderr as a string. The stdout and stderr of that command will also be printed to the stdout and stderr of this Go program to make debugging easier.

func RunCommandE

func RunCommandE(t *testing.T, command Command) error

Run a shell command and redirect its stdout and stderr to the stdout of the atomic script itself

Types

type Command

type Command struct {
	Command    string            // The command to run
	Args       []string          // The args to pass to the command
	WorkingDir string            // The working directory
	Env        map[string]string // Additional environment variables to set
}

A simpler struct for defining commands than Go's built-in Cmd

Jump to

Keyboard shortcuts

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