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.
This commit is contained in:
Alex Newman
2025-10-18 18:49:11 -04:00
parent d452913487
commit 874815770a
10 changed files with 41 additions and 7 deletions
+1
View File
@@ -16,6 +16,7 @@ try {
stdin.on('end', () => {
const parsed = input.trim() ? JSON.parse(input) : undefined;
contextHook(parsed);
process.exit(0);
});
}
} catch (error: any) {
+1
View File
@@ -14,6 +14,7 @@ stdin.on('end', async () => {
try {
const parsed = input.trim() ? JSON.parse(input) : undefined;
await newHook(parsed);
process.exit(0);
} catch (error: any) {
console.error(`[claude-mem new-hook error: ${error.message}]`);
console.log('{"continue": true, "suppressOutput": true}');
+1
View File
@@ -14,6 +14,7 @@ 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}');
+1
View File
@@ -14,6 +14,7 @@ stdin.on('end', async () => {
try {
const parsed = input.trim() ? JSON.parse(input) : undefined;
await summaryHook(parsed);
process.exit(0);
} catch (error: any) {
console.error(`[claude-mem summary-hook error: ${error.message}]`);
console.log('{"continue": true, "suppressOutput": true}');