exec

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2018 License: MPL-2.0 Imports: 5 Imported by: 63

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
	Argv []string
	Dir  string

	Env     map[string]string
	WithEnv map[string]string
}

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