From 6b534b1b8f7d4193129238a2409497328fed73ce Mon Sep 17 00:00:00 2001 From: Ben Moskovitz Date: Thu, 18 May 2023 12:43:56 +1000 Subject: [PATCH] Executable hooks on windows probably have to be .exe, ay? --- bootstrap/integration/hooks_integration_test.go | 5 +++++ hook/hook.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap/integration/hooks_integration_test.go b/bootstrap/integration/hooks_integration_test.go index 0f2629af19..f0f562b1dd 100644 --- a/bootstrap/integration/hooks_integration_test.go +++ b/bootstrap/integration/hooks_integration_test.go @@ -546,6 +546,11 @@ func TestPolyglotBinaryHooksCanBeRun(t *testing.T) { fmt.Println("Building test-binary-hook") hookPath := filepath.Join(tester.HooksDir, "environment") + + if runtime.GOOS == "windows" { + hookPath += ".exe" + } + output, err := exec.Command("go", "build", "-o", hookPath, "./test-binary-hook").CombinedOutput() if err != nil { t.Fatalf("Failed to build test-binary-hook: %v, output: %s", err, string(output)) diff --git a/hook/hook.go b/hook/hook.go index d0c2283d57..e974ecc036 100644 --- a/hook/hook.go +++ b/hook/hook.go @@ -18,7 +18,7 @@ import ( func Find(hookDir string, name string) (string, error) { if runtime.GOOS == "windows" { // check for windows types first - if p, err := shell.LookPath(name, hookDir, ".BAT;.CMD;.PS1"); err == nil { + if p, err := shell.LookPath(name, hookDir, ".BAT;.CMD;.PS1;.EXE"); err == nil { return p, nil } }