Skip to content

Commit

Permalink
Minor edits for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
moskyb committed May 22, 2023
1 parent 251b72f commit 3971f6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ func (b *Bootstrap) executeHook(ctx context.Context, hookCfg HookConfig) error {
// Regardless: not supported right now, or potentially ever.
sheb, _ := shellscript.ShebangLine(hookCfg.Path) // we know this won't error because it must have a shebang to be a script

err := fmt.Sprintf(`when trying to run the hook at %q, the agent found that it was a script with a shebang that isn't for a shellscripting language - in this case, %q.
err := fmt.Errorf(`when trying to run the hook at %q, the agent found that it was a script with a shebang that isn't for a shellscripting language - in this case, %q.
Hooks of this kind are unfortunately not supported on Windows, as we have no way of interpreting a shebang on Windows`, hookCfg.Path, sheb)
return fmt.Errorf(err)
return err
}

// It's a script, and we can rely on the OS to figure out how to run it (because we're not on windows), so run it
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/integration/hooks_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func TestPolyglotScriptHooksCanBeRun(t *testing.T) {

path, err := exec.LookPath("ruby")
if err != nil {
t.Fatal("error finding path to ruby executable: %w", err)
t.Fatalf("error finding path to ruby executable: %v", err)
}

if path == "" {
Expand All @@ -520,13 +520,13 @@ func TestPolyglotScriptHooksCanBeRun(t *testing.T) {
}

if err := os.WriteFile(filepath.Join(tester.HooksDir, filename), []byte(strings.Join(script, "\n")), 0755); err != nil {
t.Fatalf("os.WriteFile(%q, script, 0755 = %v", filename, err)
t.Fatalf("os.WriteFile(%q, script, 0755) = %v", filename, err)
}

tester.RunAndCheck(t)

if !strings.Contains(tester.Output, "ohai, it's ruby!") {
t.Fatalf("tester.Output %s does not contain expected output: %q", tester.Output, "ohai, it's ruby!")
t.Fatalf("tester.Output %q does not contain expected output: %q", tester.Output, "ohai, it's ruby!")
}
}

Expand Down

0 comments on commit 3971f6d

Please sign in to comment.