MCPcopy
hub / github.com/claude-code-best/claude-code / finalizeHook

Function finalizeHook

src/utils/hooks/AsyncHookRegistry.ts:91–111  ·  view source on GitHub ↗
(
  hook: PendingAsyncHook,
  exitCode: number,
  outcome: 'success' | 'error' | 'cancelled',
)

Source from the content-addressed store, hash-verified

89}
90
91async function finalizeHook(
92 hook: PendingAsyncHook,
93 exitCode: number,
94 outcome: 'success' | 'error' | 'cancelled',
95): Promise<void> {
96 hook.stopProgressInterval()
97 const taskOutput = hook.shellCommand?.taskOutput
98 const stdout = taskOutput ? await taskOutput.getStdout() : ''
99 const stderr = taskOutput?.getStderr() ?? ''
100 hook.shellCommand?.cleanup()
101 emitHookResponse({
102 hookId: hook.hookId,
103 hookName: hook.hookName,
104 hookEvent: hook.hookEvent,
105 output: stdout + stderr,
106 stdout,
107 stderr,
108 exitCode,
109 outcome,
110 })
111}
112
113export async function checkForAsyncHookResponses(): Promise<
114 Array<{

Callers 2

Calls 4

emitHookResponseFunction · 0.85
getStdoutMethod · 0.80
getStderrMethod · 0.80
cleanupMethod · 0.45

Tested by

no test coverage detected