mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-10 17:57:29 +00:00
19 lines
353 B
Go
19 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
|
|
}
|