Follow-up from #73 / #72.
#73 fixes watch status on Windows (via a platform-specific processAlive). It intentionally leaves watch stop non-destructive on Windows (SIGTERM is unsupported, so it returns an error without killing).
Making Windows stop actually terminate the daemon requires guarding against PID reuse: a stale .codemap/watch.pid may point to a PID the OS has reassigned to an unrelated process, and blindly Kill-ing it would terminate the wrong process (P2 raised by Codex on #73).
Work
- Implement
processCommandLine on Windows (currently a stub) — e.g. via Get-CimInstance Win32_Process / QueryFullProcessImageName — so IsOwnedDaemon can verify the PID is a codemap watch daemon <root> for this repo.
- Gate the Windows stop/kill path on that ownership check; refuse (with a clear message) when ownership can't be established.
- Consider applying the same ownership guard to the Unix stop path for consistency.
Acceptance
codemap watch stop terminates a real daemon on Windows.
- A stale
watch.pid whose PID was reused does not get killed.
Follow-up from #73 / #72.
#73 fixes
watch statuson Windows (via a platform-specificprocessAlive). It intentionally leaveswatch stopnon-destructive on Windows (SIGTERM is unsupported, so it returns an error without killing).Making Windows
stopactually terminate the daemon requires guarding against PID reuse: a stale.codemap/watch.pidmay point to a PID the OS has reassigned to an unrelated process, and blindlyKill-ing it would terminate the wrong process (P2 raised by Codex on #73).Work
processCommandLineon Windows (currently a stub) — e.g. viaGet-CimInstance Win32_Process/QueryFullProcessImageName— soIsOwnedDaemoncan verify the PID is a codemapwatch daemon <root>for this repo.Acceptance
codemap watch stopterminates a real daemon on Windows.watch.pidwhose PID was reused does not get killed.