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
This commit is contained in:
server2
2026-10-06 19:09:11 +02:00
parent dfc9a19860
commit 0f6fb88e58
+3 -1
View File
@@ -52,7 +52,9 @@ build)
;; ;;
start) start)
# newer CLIs save ~/.cache/amane/amane-shell; older ones only leave cargo's output # 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 binary=~/.cache/amane/amane-shell
test -x "$binary" || binary=~/.cache/amane/project/target/debug/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 AMANE_FRAMES=1 setsid -f sh -c "echo \$\$ > shell.pid; exec $binary" > shell.log 2>&1