Skip to content

Commit d6cd58b

Browse files
committed
fix binary check
1 parent 0c9b7b7 commit d6cd58b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cmd/tmcg/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"os"
10+
"os/exec"
1011
"path/filepath"
1112
"strings"
1213
"time"
@@ -156,10 +157,12 @@ func Run(exitFunc func(int), logger logging.Logger) {
156157

157158
// Validate Terraform binary
158159
logger.Log("debug", "Using Terraform binary: %s", binaryPath)
159-
if _, err := os.Stat(binaryPath); os.IsNotExist(err) {
160-
logger.Log("error", "Terraform binary not found at: %s", binaryPath)
160+
path, err := exec.LookPath(binaryPath)
161+
if err != nil {
162+
logger.Log("error", "Terraform binary not found in PATH: %s", binaryPath)
161163
exitFunc(1)
162164
}
165+
logger.Log("debug", "Resolved Terraform binary path: %s", path)
163166

164167
// Start timer for execution
165168
startTime := time.Now()

0 commit comments

Comments
 (0)