aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/export_test.go
blob: 6bf18ce31afdc541f55c07882d64a5c7fe3b785d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package helper

import (
	"os"
	"os/exec"
	"testing"
)

// replace execCommand to have the resulting *exec.Cmd launch TestHelperChildStub
func ReplaceExecCommand(t *testing.T) {
	t.Cleanup(func() {
		execCommand = exec.Command
	})

	execCommand = func(name string, arg ...string) *exec.Cmd {
		return exec.Command(os.Args[0], append([]string{"-test.run=TestHelperChildStub", "--", name}, arg...)...)
	}
}