exec

package
Version: v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LookPath is a function that performs `exec.LookPath`.
	// The sole purpose of this variable is to be able to mock calls to the exec module during tests.
	//
	// LookPath searches for an executable named file in the directories named by the PATH environment variable.
	// If file contains a slash, it is tried directly and the PATH is not consulted.
	// The result may be an absolute path or a path relative to the current directory.
	// (from exec.LookPath docstring)
	LookPath = DefaultLookPath

	// CommandOutput is a function that performs `exec.Command` in a certain dir, returning the command's Output().
	// The sole purpose of this variable is to be able to mock calls to the exec module during tests.
	CommandOutput = DefaultCommandOutput

	// CommandCombinedOutput is a function that performs `exec.Command` in a certain dir, returning the command's CombinedOutput().
	// The sole purpose of this variable is to be able to mock calls to the exec module during tests.
	CommandCombinedOutput = DefaultCommandCombinedOutput

	// PipelineOutput is a function that allows executing a pipeline of commands,
	// i.e. commands like `ls -l | grep exec | wc -l`
	PipelineOutput = DefaultPipelineOutput
)

Functions

func DefaultCommandCombinedOutput

func DefaultCommandCombinedOutput(dir string, name string, args ...string) ([]byte, error)

DefaultCommandOutput simply calls os/exec.Command, sets the directory and returns the command's Output().

func DefaultCommandOutput

func DefaultCommandOutput(dir string, name string, args ...string) ([]byte, error)

DefaultCommandOutput simply calls os/exec.Command, sets the directory and returns the command's Output().

func DefaultLookPath

func DefaultLookPath(file string) (string, error)

DefaultLookPath simply calls os/exec.LookPath

func DefaultPipelineOutput

func DefaultPipelineOutput(dir string, commands ...[]string) ([]byte, error)

Types

This section is empty.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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