From 033811d35b2efd64809ceed98e2fd246684a3cec Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sun, 9 Aug 2026 05:39:23 +0000 Subject: [PATCH] Fix initial session for osh --- migrated/.zshrc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/migrated/.zshrc b/migrated/.zshrc index e098d5e..4a791c8 100644 --- a/migrated/.zshrc +++ b/migrated/.zshrc @@ -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 ) &