-
fix: kill cowork daemon on app quit (#391)
发布于
2026-04-12 23:45:54 +00:00 - fix: kill cowork daemon on app quit
The upstream cowork-vm-shutdown quit handler uses the Swift VM addon
which isn't available on Linux, so it's never registered. Our forked
cowork-vm-service daemon was invisible to the quit system, surviving
app exit and leaving QEMU/virtiofsd processes running.Register a Linux-specific quit handler via the upstream
registerQuitHandler infrastructure. The handler sends SIGTERM to the
daemon (which already handles it gracefully), verifies the PID via
/proc/cmdline to prevent killing the wrong process on PID reuse, and
polls for exit up to 10 seconds.The daemon PID is captured at fork time on a global, avoiding any
need for pgrep/execSync at quit time. The handler is registered
unconditionally for Linux so it works regardless of how the daemon
was launched.Fixes #369
Co-Authored-By: Claude claude@anthropic.com
- style: simplify quit handler patch comments and scope
Add block scope for consistency with Patches 8-9, trim header comment,
remove hardcoded minified name from implementation comment, simplify
insertIdx calculation to match Patch 4 pattern.Co-Authored-By: Claude claude@anthropic.com
Co-authored-by: Claude claude@anthropic.com
下载附件