package exec
import "k8s.io/kubernetes/pkg/util/exec"
Package exec provides an injectable interface and implementations for running commands.
Index ¶
Types ¶
type Cmd ¶
type Cmd interface { // CombinedOutput runs the command and returns its combined standard output // and standard error. This follows the pattern of package os/exec. CombinedOutput() ([]byte, error) }
Cmd is an interface that presents an API that is very similar to Cmd from os/exec. As more functionality is needed, this can grow. Since Cmd is a struct, we will have to replace fields with get/set method pairs.
type ExitError ¶
ExitError is an interface that presents an API similar to os.ProcessState, which is what ExitError from os/exec is. This is designed to make testing a bit easier and probably loses some of the cross-platform properties of the underlying library.
type Interface ¶
type Interface interface { // Command returns a Cmd instance which can be used to run a single command. // This follows the pattern of package os/exec. Command(cmd string, args ...string) Cmd }
Interface is an interface that presents a subset of the os/exec API. Use this when you want to inject fakeable/mockable exec behavior.
func New ¶
func New() Interface
New returns a new Interface which will os/exec to run commands.
Source Files ¶
doc.go exec.go
- Version
- v0.4.4
- Published
- Nov 19, 2014
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 1 minute ago –
Tools for package owners.