Skip to content

Commit 04e1103

Browse files
committed
fix: re-download cached func CLI binary if not executable
ensureFuncVersion() only checked if the cached binary file existed, not whether it had execute permission. If the binary lost its execute bit (e.g. due to a partial download or filesystem issue in CI), the test would fail with "permission denied" and cascade-fail other specs.
1 parent 460ac39 commit 04e1103

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

test/utils/func.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,14 @@ func ensureFuncVersion(version string) (string, error) {
187187
versionDir := filepath.Join(projectDir, "bin", "func-cli", version)
188188
funcBinary := filepath.Join(versionDir, "func")
189189

190-
// Check if already cached
191-
if _, err := os.Stat(funcBinary); err == nil {
192-
return funcBinary, nil
190+
// Check if already cached and executable
191+
if info, err := os.Stat(funcBinary); err == nil {
192+
isExecutable := info.Mode().Perm()&0o111 != 0
193+
if isExecutable {
194+
return funcBinary, nil
195+
}
196+
// Binary exists but is not executable — remove and re-download
197+
os.Remove(funcBinary)
193198
}
194199

195200
// Download the version

0 commit comments

Comments
 (0)