Skip to content

Commit

Permalink
[Fix sorin-ionescu#479] Start only one ssh-agent instance
Browse files Browse the repository at this point in the history
  • Loading branch information
sorin-ionescu authored and Jeff Knupp committed Oct 15, 2013
1 parent 35311b9 commit 5bdec20
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/ssh/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ _ssh_agent_sock="$TMPDIR/ssh-agent.sock"

# Start ssh-agent if not started.
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
else
# Export environment variables.
source "$_ssh_agent_env" 2> /dev/null

# Start ssh-agent if not started.
if ! ps -U "$USER" -o pid,ucomm | grep -q "${SSH_AGENT_PID} ssh-agent"; then
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
fi
fi

# Create a persistent SSH authentication socket.
Expand Down

0 comments on commit 5bdec20

Please sign in to comment.