fix ssh module starting redundant agents in cygwin

This commit is contained in:
Jeff Kinslow 2013-09-22 14:44:38 -04:00
parent eb1a20552a
commit 7c59c4d0ad

View file

@ -21,10 +21,14 @@ _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
# Check if process is still running.
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ &> /dev/null || {
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
# Source new environment variables.
source "$_ssh_agent_env" 2> /dev/null
}
fi fi
# Create a persistent SSH authentication socket. # Create a persistent SSH authentication socket.