shell

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package shell allows to run commands in a shell.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExitCodeForRunCommandError

func GetExitCodeForRunCommandError(err error) (int, error)

GetExitCodeForRunCommandError tries 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)

RunCommand runs a shell command and redirects its stdout and stderr to the stdout of the atomic script itself.

func RunCommandAndGetOutput

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

RunCommandAndGetOutput runs a shell command and returns 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)

RunCommandAndGetOutputE runs a shell command and returns 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

RunCommandE runs a shell command and redirects 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
}

Command is 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