Skip to content

Commit

Permalink
Merge pull request #2948 from mcncl/main
Browse files Browse the repository at this point in the history
 Fix error when hook cannot be run due to missing interpreter
  • Loading branch information
mcncl authored Aug 26, 2024
2 parents 65ed6aa + 88bdb20 commit 7173de0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/job/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func logOpenedHookInfo(l shell.Logger, debug bool, hookName, path string) {
}
}

func logMissingHookInfo(l shell.Logger, wrapperPath string) {
func logMissingHookInfo(l shell.Logger, hookName, wrapperPath string) {
// It's unlikely, but possible, that the script wrapper was spontaneously
// deleted or corrupted (it's usually in /tmp, which is fair game).
// A common setup error is to try to run a Bash hook in a container or other
Expand All @@ -445,7 +445,7 @@ func logMissingHookInfo(l shell.Logger, wrapperPath string) {
if err != nil {
// It's reasonable to assume the script wrapper was spontaneously
// deleted, or had something equally horrible happen to it.
l.Errorf("The %s hook failed to run - perhaps the wrapper script %q was spontaneously deleted", wrapperPath)
l.Errorf("The %s hook failed to run - perhaps the wrapper script %q was spontaneously deleted", hookName, wrapperPath)
return
}
interpreter := strings.TrimPrefix(shebang, "#!")
Expand All @@ -458,7 +458,7 @@ func logMissingHookInfo(l shell.Logger, wrapperPath string) {
// than ENOENT.
return
}
l.Errorf("The %s hook failed to run - perhaps the script interpreter %q is missing", interpreter)
l.Errorf("The %s hook failed to run - perhaps the script interpreter %q is missing", hookName, interpreter)
}

func (e *Executor) runWrappedShellScriptHook(ctx context.Context, hookName string, hookCfg HookConfig) error {
Expand Down Expand Up @@ -531,7 +531,7 @@ func (e *Executor) runWrappedShellScriptHook(ctx context.Context, hookName strin
// program we tried to exec, even if the missing file/directory was
// actually the interpreter specified on the shebang line.
// Try to figure out which part is missing from the wrapper.
logMissingHookInfo(e.shell.Logger, script.Path())
logMissingHookInfo(e.shell.Logger, hookName, script.Path())
}

return err
Expand Down

0 comments on commit 7173de0

Please sign in to comment.