MCPcopy Create free account
hub / github.com/docker/docker-agent / Run

Method Run

pkg/hooks/handler.go:299–316  ·  view source on GitHub ↗
(ctx context.Context, input []byte)

Source from the content-addressed store, hash-verified

297}
298
299func (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}

Callers

nothing calls this directly

Calls 3

hookWorkingDirFunction · 0.85
withHookEnvFunction · 0.85
fnMethod · 0.80

Tested by

no test coverage detected