Companion to #1 — same shape, different file: a guard that fails open instead of loud.
examples/paseo/desvio.conf:31 resolves the running daemon's cwd with lsof:
cwd=$(lsof -a -p "$pid" -d cwd -Fn 2>/dev/null | sed -n 's/^n//p' | head -1)
case "${cwd:-}" in
"$DESVIO_WORKTREE"|"$DESVIO_WORKTREE"/*) die "a daemon (pid $pid) is serving from this tree: ..." ;;
esac
lsof is not installed by default on Arch (and is absent from most minimal images). When it is missing, cwd is empty, ${cwd:-} matches no branch, and desvio_preflight returns 0 — so the guard that is supposed to refuse to build under a live daemon quietly permits it. The README is explicit about why that guard exists:
One worktree. Anything that reads the tree while desvio rewrites it will misbehave; that is what desvio_preflight is for.
The failure mode is the bad one: a rebuild rewrites dist/ under a daemon that lazily requires from it, and nothing warned.
Same dependency in examples/paseo/start.sh:79,162 and install.sh:86-88, where a missing lsof degrades the "who holds 6767" and "which tree is it serving" reporting rather than a safety check.
Suggestion
/proc/<pid>/cwd is exact, needs no extra process, and is not subject to lsof's permission quirks. Keeping the lsof branch preserves macOS:
if [ -r "/proc/$pid/cwd" ]; then
cwd=$(readlink "/proc/$pid/cwd" 2>/dev/null)
else
cwd=$(lsof -a -p "$pid" -d cwd -Fn 2>/dev/null | sed -n 's/^n//p' | head -1)
fi
Running that locally and it works fine. For the port-holder lookup in install.sh, ss -lptnH "sport = :6767" is the usual Linux equivalent.
Happy to send a PR across the three files if you want it — held off because the approach is a judgement call about your example, and install.sh/start.sh use lsof for reporting rather than for a guard, so they may deserve different treatment.
🤖 Generated with Claude Code
Companion to #1 — same shape, different file: a guard that fails open instead of loud.
examples/paseo/desvio.conf:31resolves the running daemon's cwd withlsof:lsofis not installed by default on Arch (and is absent from most minimal images). When it is missing,cwdis empty,${cwd:-}matches no branch, anddesvio_preflightreturns 0 — so the guard that is supposed to refuse to build under a live daemon quietly permits it. The README is explicit about why that guard exists:The failure mode is the bad one: a rebuild rewrites
dist/under a daemon that lazily requires from it, and nothing warned.Same dependency in
examples/paseo/start.sh:79,162andinstall.sh:86-88, where a missinglsofdegrades the "who holds 6767" and "which tree is it serving" reporting rather than a safety check.Suggestion
/proc/<pid>/cwdis exact, needs no extra process, and is not subject to lsof's permission quirks. Keeping thelsofbranch preserves macOS:Running that locally and it works fine. For the port-holder lookup in
install.sh,ss -lptnH "sport = :6767"is the usual Linux equivalent.Happy to send a PR across the three files if you want it — held off because the approach is a judgement call about your example, and
install.sh/start.shuselsoffor reporting rather than for a guard, so they may deserve different treatment.🤖 Generated with Claude Code