From f3be9350756ff09dc6f1bbbbaa7f53231a5f902b Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 22 Jan 2022 21:31:04 -0800 Subject: [PATCH] [zsh] Attempt to make establishing an ssh-agent session more robust I don't think this quite works though. --- zprofile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zprofile b/zprofile index 122f2cb..7cd1b0d 100644 --- a/zprofile +++ b/zprofile @@ -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