Files
claude-mem/src/bin/hooks/save-hook.ts
T
Alex Newman 874815770a fix: Add missing process.exit(0) calls in hook entry points
All 4 hook entry point scripts were missing process.exit(0) after successful
execution, causing Node processes to hang indefinitely instead of returning
control to Claude Code with exit code 0.

Root cause: In commit 6f62a56, process.exit(0) calls were removed from the
hook functions but were never added to the entry point scripts that wrap them.

Fixed files:
- src/bin/hooks/save-hook.ts (PostToolUse)
- src/bin/hooks/new-hook.ts (UserPromptSubmit)
- src/bin/hooks/summary-hook.ts (Stop)
- src/bin/hooks/context-hook.ts (SessionStart)

This restores proper hook exit behavior and prevents Claude Code from waiting
indefinitely for hook completion.
2025-10-18 18:49:11 -04:00

24 lines
597 B
TypeScript

/**
* Save Hook Entry Point - PostToolUse
* Standalone executable for plugin hooks
*/
import { saveHook } from '../../hooks/save.js';
import { stdin } from 'process';
// Read input from stdin
let input = '';
stdin.on('data', (chunk) => input += chunk);
stdin.on('end', async () => {
try {
const parsed = input.trim() ? JSON.parse(input) : undefined;
await saveHook(parsed);
process.exit(0);
} catch (error: any) {
console.error(`[claude-mem save-hook error: ${error.message}]`);
console.log('{"continue": true, "suppressOutput": true}');
process.exit(0);
}
});