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