Use named tmux session

This commit is contained in:
Manuel Thalmann 2024-10-31 15:16:25 +01:00
parent a34ee1847b
commit e24ed85fa9

View file

@ -11,7 +11,7 @@ function waitNetwork -a witness
if [ -z "$witness" ] if [ -z "$witness" ]
if not testNetwork &>/dev/null if not testNetwork &>/dev/null
tmux new-session -d 'cat /etc/motd; echo "$(tput bold)Please establish an internet connection...$(tput sgr0)"; $SHELL' tmux new-session -s network -d 'cat /etc/motd; echo "$(tput bold)Please establish an internet connection...$(tput sgr0)"; $SHELL'
fish (status filename) true & fish (status filename) true &
set -l pid "$last_pid" set -l pid "$last_pid"
@ -23,7 +23,7 @@ function waitNetwork -a witness
end end
end end
tmux attach tmux attach -t network
wait "$pid" wait "$pid"
return "$(cat "$codeFile")" return "$(cat "$codeFile")"
end end
@ -34,13 +34,13 @@ function waitNetwork -a witness
set x (math $x + 1) set x (math $x + 1)
if testNetwork &>/dev/null if testNetwork &>/dev/null
tmux kill-session &>/dev/null tmux kill-session -t network &>/dev/null
break break
else else
not tmux list-sessions &>/dev/null not tmux list-sessions -f "#{==:#S,network}" &>/dev/null
or test "$x" -gt 10 or test "$x" -gt 10
and begin and begin
tmux kill-session &>/dev/null tmux kill-session -t network &>/dev/null
exit 1 exit 1
end end
end end