exec

package
v0.7.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: MPL-2.0 Imports: 5 Imported by: 3 modules, 63 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(cmd Cmd) (stdout string, stderr string, err error)

Run executes a `Cmd`.

func Which

func Which(arg string, cmds ...string) (cmd string, output string, err error)

Which picks a command out of a list of candidates.

func WhichArgs

func WhichArgs(argv []string, cmds ...string) (cmd string, output string, err error)

WhichArgs is `Which` but passes multiple arguments to each candidate.

func WhichWithResolver

func WhichWithResolver(cmds []string, resolve WhichResolver) (string, string, error)

WhichWithResolver is `Which` with a custom resolution strategy.

Types

type Cmd

type Cmd struct {
	Name string   // Command name.
	Argv []string // Command arguments.
	Dir  string   // Command's working directory.

	// If neither Env nor WithEnv are set, the environment is inherited from os.Environ().
	Env     map[string]string // If set, the command's environment is _set_ to Env.
	WithEnv map[string]string // If set, the command's environment is _added_ to WithEnv.
}

Cmd represents a single command.

type WhichResolver

type WhichResolver func(cmd string) (output string, ok bool, err error)

A WhichResolver takes a candidate command and returns whether to choose it.

Jump to

Keyboard shortcuts

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