Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WithContext = func(ctx context.Context) func(c *commandeer) {
return func(c *commandeer) {
c.ctx = ctx
}
}
View Source
var WithDir = func(dir string) func(c *commandeer) {
return func(c *commandeer) {
c.dir = dir
}
}
View Source
var WithEnviron = func(env []string) func(c *commandeer) { return func(c *commandeer) { setOrAppend := func(s string) { k1, _ := config.SplitEnvVar(s) var found bool for i, v := range c.env { k2, _ := config.SplitEnvVar(v) if k1 == k2 { found = true c.env[i] = s } } if !found { c.env = append(c.env, s) } } for _, s := range env { setOrAppend(s) } } }
View Source
var WithStderr = func(w io.Writer) func(c *commandeer) {
return func(c *commandeer) {
c.stderr = w
}
}
View Source
var WithStdin = func(r io.Reader) func(c *commandeer) {
return func(c *commandeer) {
c.stdin = r
}
}
View Source
var WithStdout = func(w io.Writer) func(c *commandeer) {
return func(c *commandeer) {
c.stdout = w
}
}
Functions ¶
func IsNotFound ¶ added in v0.91.0
IsNotFound reports whether this is an error about a binary not found.
func LookPath ¶ added in v0.91.0
LookPath finds the path to binaryName in $PATH. Returns "" if not found.
func SafeCommand ¶
SafeCommand is a wrapper around os/exec Command which uses a LookPath implementation that does not search in current directory before looking in PATH. See https://github.com/cli/safeexec and the linked issues.
Types ¶
type Exec ¶ added in v0.91.0
type Exec struct {
// contains filtered or unexported fields
}
Exec enforces a security policy for commands run via os/exec.
func (*Exec) New ¶ added in v0.91.0
New will fail if name is not allowed according to the configured security policy. Else a configured Runner will be returned ready to be Run.
type NotFoundError ¶ added in v0.91.0
type NotFoundError struct {
// contains filtered or unexported fields
}
func (*NotFoundError) Error ¶ added in v0.91.0
func (e *NotFoundError) Error() string
Click to show internal directories.
Click to hide internal directories.