// CommandContext returns a test command with the given context.
CommandContext returns a test command with the given context.
// CommandContext returns a test command with the given context .
func (mb *MockBuilder) CommandContext(ctx context.Context, cmd string, args ...string) *osexec.Cmd {
	cs := []string{"-test.run=" + mb.Helper, "--", "cmd"}
	cs = append(cs, args...)
	command := osexec.CommandContext(ctx, os.Args[0], cs...)
	command.Env = []string{"MOCK_EXEC_HELPER_PROCESS=1"}
	var entry *MockEntry
	if mb.Index >= 0 && mb.Index < len(mb.Entries) {
		entry = &mb.Entries[mb.Index]
		mb.Index++
	}
	command.Env = append(command.Env, entry.GetEnvVars()...)
	return command
}
func ( mb * MockBuilder ) CommandContext ( ctx context . Context , cmd string , args ... string ) * osexec . Cmd { cs := [ ] string { " " + mb . Helper , " " , " " } cs = append ( cs , args ... ) command := osexec . CommandContext ( ctx , os . Args [ 0 ] , cs ... ) command . Env = [ ] string { " " } var entry * MockEntry if mb . Index >= 0 && mb . Index < len ( mb . Entries ) { entry = & mb . Entries [ mb . Index ] mb . Index ++ } command . Env = append ( command . Env , entry . GetEnvVars ( ) ... ) return command }
CommandContext returns a test command with the given context.
CommandContext returns a test command with the given context .