Fix initial session for osh
Nix Flake Check / check (push) Successful in 59s

This commit is contained in:
2026-08-09 05:39:23 +00:00
parent d3fc1ff511
commit 033811d35b
+10 -1
View File
@@ -169,9 +169,18 @@ colordiff() {
osh() {
local DEST="$1"
local PARENT_PID=$$
_osh_ensure_ssh() {
ssh -A -o ServerAliveInterval=2 -o ServerAliveCountMax=3 -o ControlPersist=yes "$@"
}
# Authenticate in foreground first to ensure Touch ID doesn't conflict with mosh
_osh_ensure_ssh "$DEST" true
(
while kill -0 $PARENT_PID 2>/dev/null; do
ssh -O check "$DEST" 2>/dev/null || ssh -A -o ServerAliveInterval=2 -o ServerAliveCountMax=3 -o ControlPersist=yes "$DEST" "sleep 2592000"
# Avoid using TTY as that will instantly suspend the loop
_osh_ensure_ssh -n -q -o BatchMode=yes "$DEST" "sleep 2592000"
sleep 1
done
) &