mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-15 02:20:19 +00:00
29 lines
429 B
Go
29 lines
429 B
Go
package exec
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"os/exec"
|
|
)
|
|
|
|
// Cmd is a hook for mocking
|
|
type Cmd interface {
|
|
StdoutPipe() (io.ReadCloser, error)
|
|
Start() error
|
|
Wait() error
|
|
Process() *os.Process
|
|
}
|
|
|
|
// 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) Process() *os.Process {
|
|
return c.Cmd.Process
|
|
}
|