func FakeExecCommand(testToCall string, stdout, stderr *bytes.Buffer) func(string, ...string) *command.Cmd {
	calls := 0
	var savedStdout io.Writer
	if stderr == nil {
		stderr = &bytes.Buffer{}
	}
	return func(c string, args ...string) *command.Cmd {
		cs := []string{"-test.run=" + testToCall, "--", c}
		cs = append(cs, args...)
		cmd := &command.Cmd{
			Cmd: exec.Command(os.Args[0], cs...),
		}
		if calls == 0 {
			startCall(stderr)
		}
		cmd.Run = func() error {
			if calls > 0 {
				willAppendCall(stderr)
			}
			savedStdout = cmd.Stdout
			cmd.Stdout = stdout
			cmd.Stderr = stderr
			cmd.Env = append(cmd.Env, "GO_WANT_HELPER_PROCESS=1")
			err := cmd.Cmd.Run()
			io.Copy(savedStdout, stdout)
			calls++
			return err
		}
		return cmd
	}
}
FakeExecCommand resturns a fake function which calls into testToCall
this is used to mock an exec.Cmd
Adapted from https://npf.io/2015/06/testing-exec-command/
package testutil
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"os/exec"
	"strings"
	"github.com/davidovich/summon/pkg/command"
	"github.com/spf13/afero"
)
var GetFs func() afero.Fs
var SetFs func(fs afero.Fs)
func ReplaceFs() func() {
	oldFs := GetFs()
	SetFs(afero.NewMemMapFs())
	return func() {
		SetFs(oldFs)
	}
}
type Call struct {
	Args string
	Env  []string
	Out  string
}
type Calls struct {
	Calls []Call
}