mirror of https://github.com/fluxcd/flux2.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
353 B
Go
20 lines
353 B
Go
package test
|
|
|
|
import (
|
|
"context"
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
type whichTerraform struct{}
|
|
|
|
func (w *whichTerraform) ExecPath(ctx context.Context) (string, error) {
|
|
cmd := exec.CommandContext(ctx, "which", "terraform")
|
|
output, err := cmd.Output()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
path := strings.TrimSuffix(string(output), "\n")
|
|
return path, nil
|
|
}
|