Browse Source

[Fix #479] Start only one ssh-agent instance

master
Sorin Ionescu 11 years ago
parent
commit
a4bacb8bb9
  1. 7
      modules/ssh/init.zsh

7
modules/ssh/init.zsh

@ -21,10 +21,13 @@ _ssh_agent_sock="$TMPDIR/ssh-agent.sock"
# Start ssh-agent if not started. # Start ssh-agent if not started.
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
else
# Export environment variables. # Export environment variables.
source "$_ssh_agent_env" 2> /dev/null 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 fi
# Create a persistent SSH authentication socket. # Create a persistent SSH authentication socket.

Loading…
Cancel
Save