Files
weave-scope/common/exec/exec.go
2015-10-21 15:17:41 +00:00

29 lines
449 B
Go

package exec
import (
"io"
"os/exec"
)
// Cmd is a hook for mocking
type Cmd interface {
StdoutPipe() (io.ReadCloser, error)
StderrPipe() (io.ReadCloser, error)
Start() error
Wait() error
Kill() error
}
// Command is a hook for mocking
var Command = func(name string, args ...string) Cmd {
return &realCmd{exec.Command(name, args...)}
}
type realCmd struct {
*exec.Cmd
}
func (c *realCmd) Kill() error {
return c.Cmd.Process.Kill()
}