aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/mock/process.go
blob: 808ccf001b247e53b47b1ba2ef33e3b04afc13ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package mock

import "fmt"

type Exec struct {
	ProgramPath    string
	CombinedOutput string
}

func (c *Exec) LookPath(name string) (string, error) {
	if c.ProgramPath == "" {
		return "", fmt.Errorf("no program path set in this mock")
	}
	return c.ProgramPath, nil
}

func (c *Exec) Run(name string, args ...string) ([]byte, error) {
	return []byte(c.CombinedOutput), nil
}