mirror of
https://github.com/aaddrick/claude-desktop-debian.git
synced 2026-05-17 08:36:35 +03:00
Follow-up to #453: the daemon still spawns virtiofsd via PATH lookup (`spawnProcess('virtiofsd', ...)`), so on stock Debian/Ubuntu (`/usr/libexec/virtiofsd`) and Arch/CachyOS/Manjaro (`/usr/lib/virtiofsd`) the spawn ENOENTs and KvmBackend silently falls through to virtio-9p — users who opted into `COWORK_VM_BACKEND=kvm` and installed virtiofsd get 9p performance without knowing. Mirror doctor.sh's `_find_virtiofsd` in JS: probe `COWORK_VM_VIRTIOFSD_BIN` override, then `which`, then the same fallback list. Pass the resolved absolute path as argv[0] so the spawn bypasses PATH entirely. Also: - Add a `spawnFailed` flag the socket-wait loop checks for early exit when the async 'error' event fires (e.g. binary removed between probe and exec) — prevents a 5s stall before 9p fallback. - Guard `this.virtiofsdProcess.kill()` against the race where the error handler has already zeroed it. - Rename doctor.sh's test hook `_COWORK_DOCTOR_VFSD_PATHS` → `_COWORK_VFSD_PATHS` so doctor and daemon share the same env var for lock-step test parity (shipped 24h ago in #453, zero external users). Verified on CachyOS via a node harness covering 8 scenarios: PATH hit, fallback hit, fallback ordering, total miss, non-executable rejection, explicit override wins over PATH, override non-executable → null, override missing → null (no fall-through). All 45 BATS tests still pass after the env-var rename. Not verifiable locally: Ubuntu `/usr/libexec/virtiofsd` hit (needs an Ubuntu VM with `qemu-system-common`). Logic is symmetric to the Arch case that is verified. Co-authored-by: Claude <claude@anthropic.com>