Register newly found socket in agents file.

This commit is contained in:
Darren 'Tadgy' Austin 2019-07-02 04:15:59 +01:00
commit 68f151bc7f
2 changed files with 8 additions and 2 deletions

View file

@ -12,8 +12,14 @@ _agent_prompt_command() {
SOCK="$(_find_agent_sock)"
if ((${PIPESTATUS[0]} == 0)); then
export SSH_AUTH_SOCK="$SOCK"
_lock_agents_file && {
if _push_agent_sock; then
echo "Connected to alternate ssh-agent - you may need to re-add keys."
else
echo "Connected to, but failed to register, alternate ssh-agent - you may need to re-add keys."
fi
}
_SSH_PROMPT_ERROR_ISSUED=0
echo "Connected to alternate ssh-agent - you may need to re-add keys."
else
if [[ -z "$(egrep -v '^$' ~/.ssh/agents)" ]]; then
((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {