Skip to content

Commit

Permalink
Executable hooks on windows probably have to be .exe, ay?
Browse files Browse the repository at this point in the history
  • Loading branch information
moskyb committed May 18, 2023
1 parent 5456bcb commit 2f7e950
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bootstrap/integration/hooks_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 2f7e950

Please sign in to comment.