mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-09-19 07:34:57 +08:00
cfa293539f
On Windows, calling process.exit() while a recursive fs.watch handle is still tearing down aborts the daemon with a libuv UV_HANDLE_CLOSING assertion (0xC0000409) — reproducible whenever the indexed tree contains a nested repo (submodule / embedded clone), since that's what keeps a watch active at shutdown. A small exit delay doesn't help; only letting the loop drain is clean (verified on a real Windows VM: close()+exit() and close()+setTimeout(exit) both abort, while letting the loop drain exits 0). finalizeDaemonExit() now exits immediately on POSIX (unchanged) but on Windows marks success (exitCode=0) and lets the loop drain to a natural exit, with an unref'd backstop that force-exits only if a stray handle would otherwise hang shutdown. The daemon's own timers are already unref'd and its PPID watchdog lives in the proxy, so nothing keeps the loop alive past the closing watch handles — natural drain is fast. Pure + platform-injected so both branches unit-test off-Windows. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4.0 KiB
4.0 KiB