itwillsync
itwillsync copied to clipboard
[Bug] Missing SIGHUP handler leaves daemon uncleanly terminated
Bug: Missing SIGHUP handler leaves daemon uncleanly terminated
Location: packages/hub/src/daemon.ts lines 203-211
Problem: The daemon registers handlers for SIGTERM and SIGINT but not SIGHUP. When a user closes the terminal window on Windows, SIGHUP is sent but cleanup() is never called, leaving:
- Orphaned Windows Firewall rules
- Leftover
hub.pidandhub.jsonfiles - Stuck sleep prevention flag
- Orphaned node processes
Suggested fix: Add SIGHUP handler alongside existing SIGTERM/SIGINT:
process.on("SIGHUP", () => {
cleanup();
process.exit(0);
});
Environment: Windows 11 + WSL2 (Hyper-V), Node.js 20.x
Completely missed this BUG, will look into this EOD.