This commit is contained in:
Chris Tate
2026-01-11 10:08:08 -06:00
parent ee4eacff27
commit 3bd331b97f
2 changed files with 70 additions and 11 deletions
+19
View File
@@ -228,6 +228,25 @@ export async function startDaemon(): Promise<void> {
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
process.on('SIGHUP', shutdown);
// Handle unexpected errors - always cleanup
process.on('uncaughtException', (err) => {
console.error('Uncaught exception:', err);
cleanupSocket();
process.exit(1);
});
process.on('unhandledRejection', (reason) => {
console.error('Unhandled rejection:', reason);
cleanupSocket();
process.exit(1);
});
// Cleanup on normal exit
process.on('exit', () => {
cleanupSocket();
});
// Keep process alive
process.stdin.resume();