// HasExec reports whether the current system can start new processes // using os.StartProcess or (more commonly) exec.Command. func HasExec() bool { … } var tryExecOnce … var tryExecOk … // NeedsExec checks that the current system can start new processes // using os.StartProcess or (more commonly) exec.Command. // If not, NeedsExec calls t.Skip with an explanation. func NeedsExec(t testing.TB) { … } // CommandContext is like exec.CommandContext, but: // - skips t if the platform does not support os/exec, // - if supported, sends SIGQUIT instead of SIGKILL in its Cancel function // - if the test has a deadline, adds a Context timeout and (if supported) WaitDelay // for an arbitrary grace period before the test's deadline expires, // - if Cmd has the Cancel field, fails the test if the command is canceled // due to the test's deadline, and // - sets a Cleanup function that verifies that the test did not leak a subprocess. func CommandContext(t testing.TB, ctx context.Context, name string, args ...string) *exec.Cmd { … } // Command is like exec.Command, but applies the same changes as // testenv.CommandContext (with a default Context). func Command(t testing.TB, name string, args ...string) *exec.Cmd { … }