From 0f6fb88e58db5fe114b73481bf91761c549b9a18 Mon Sep 17 00:00:00 2001 From: server2 Date: Tue, 6 Oct 2026 19:09:11 +0200 Subject: [PATCH] tools: start waits for the old shell to exit an old shell can take a few seconds to let go of amane's socket, and the new one then panics with 'amane is already running'; wait up to 5 s --- tools/amane-remote.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/amane-remote.sh b/tools/amane-remote.sh index 69934a3..45c0bb6 100755 --- a/tools/amane-remote.sh +++ b/tools/amane-remote.sh @@ -52,7 +52,9 @@ build) ;; start) # newer CLIs save ~/.cache/amane/amane-shell; older ones only leave cargo's output - remote 'test -f shell.pid && kill $(cat shell.pid) 2>/dev/null; sleep 0.5 + # the old shell can take a few seconds to let go of amane's socket; wait for it, or the new one panics + remote 'test -f shell.pid && kill $(cat shell.pid) 2>/dev/null + for i in $(seq 50); do pgrep -F shell.pid > /dev/null 2>&1 || break; sleep 0.1; done binary=~/.cache/amane/amane-shell test -x "$binary" || binary=~/.cache/amane/project/target/debug/amane-shell AMANE_FRAMES=1 setsid -f sh -c "echo \$\$ > shell.pid; exec $binary" > shell.log 2>&1