fix ssh module starting redundant agents in cygwin
This commit is contained in:
parent
eb1a20552a
commit
7c59c4d0ad
1 changed files with 6 additions and 2 deletions
|
@ -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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue