[zsh] Attempt to make establishing an ssh-agent session more robust

I don't think this quite works though.
This commit is contained in:
Eryn Wells 2022-01-22 21:31:04 -08:00
parent fc3c6261e6
commit f3be935075

View file

@ -3,8 +3,12 @@
# Start SSH agent for password-less logins
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
eval `ssh-agent -s`
trap "kill $SSH_AGENT_PID" 0
if ! pgrep -u $USER ssh-agent 1>/dev/null; then
eval $(ssh-agent -s > ~/.ssh_agent_vars)
trap "kill $SSH_AGENT_PID" 0
else
eval $(cat ~/.ssh_agent_vars)
fi
fi
autoload list_tmux_sessions