From ddaef1f805aa17e424d7c0ec4eb34d61bddfbd44 Mon Sep 17 00:00:00 2001 From: server2 Date: Thu, 8 Oct 2026 01:37:10 +0200 Subject: [PATCH] tools: start leaves a shell it didn't start alone the user may run amane from a terminal; start used to crash into it with 'amane is already running'. now it says which pid runs and stops --- tools/amane-remote.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/amane-remote.sh b/tools/amane-remote.sh index 459dc20..836adc7 100755 --- a/tools/amane-remote.sh +++ b/tools/amane-remote.sh @@ -55,6 +55,9 @@ start) # 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 + # a shell this script did not start belongs to the user: leave it, and say so + other=$(pgrep -x amane-shell) + if [ -n "$other" ]; then echo "not started: another amane-shell runs (pid $other), not started by this script"; exit 1; fi 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