Non-DI approach to the exec.Command mocking

This commit is contained in:
Erin Call
2019-12-05 09:57:59 -08:00
parent 990d1856d8
commit e77f6842b9
3 changed files with 15 additions and 9 deletions

View File

@@ -41,6 +41,10 @@ type execCmd struct {
*exec.Cmd
}
var Command = func() cmd {
return &execCmd{}
}
func (c *execCmd) Path(p string) { c.Cmd.Path = p }
func (c *execCmd) Args(a []string) { c.Cmd.Args = a }
func (c *execCmd) Env(e []string) { c.Cmd.Env = e }