(ctx context.Context, input []byte)
| 297 | } |
| 298 | |
| 299 | func (h *builtinHandler) Run(ctx context.Context, input []byte) (HandlerResult, error) { |
| 300 | var in Input |
| 301 | if err := json.Unmarshal(input, &in); err != nil { |
| 302 | return HandlerResult{ExitCode: -1}, fmt.Errorf("decode hook input: %w", err) |
| 303 | } |
| 304 | // A working_dir override repoints Input.Cwd, the directory every |
| 305 | // builtin keys off. With no override Input.Cwd is left as-is so |
| 306 | // callers that supply a cwd (e.g. the worktree_create event) keep it. |
| 307 | if h.workingDir != "" { |
| 308 | in.Cwd = hookWorkingDir(h.baseDir, h.workingDir) |
| 309 | } |
| 310 | ctx = withHookEnv(ctx, h.env) |
| 311 | out, err := h.fn(ctx, &in, h.args) |
| 312 | if err != nil { |
| 313 | return HandlerResult{ExitCode: -1}, err |
| 314 | } |
| 315 | return HandlerResult{Output: out}, nil |
| 316 | } |
nothing calls this directly
no test coverage detected