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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user