From a13654a6d02f286ad47370bdfdbdcaf2f3bedc28 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 23 Apr 2018 00:04:26 -0400 Subject: [PATCH] Fix env.zsh spawning too many ssh-agent processes --- base/arch-desktop/env.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/base/arch-desktop/env.zsh b/base/arch-desktop/env.zsh index 11b5b099..3bd8f683 100644 --- a/base/arch-desktop/env.zsh +++ b/base/arch-desktop/env.zsh @@ -4,11 +4,13 @@ export GTK2_RC_FILES="${0:A:h}/config/gtk-2.0/gtkrc" export URXVT_PERL_LIB="$XDG_CONFIG_HOME/urxvt" export QT_QPA_PLATFORMTHEME=gtk2 -_is_running ssh-agent || { +_source "$XDG_RUNTIME_DIR/ssh-agent-env" >/dev/null +if [[ -z $SSH_AGENT_PID ]] || ! ps $SSH_AGENT_PID >/dev/null; then ssh-agent -s >"$XDG_RUNTIME_DIR/ssh-agent-env" -} + _source "$XDG_RUNTIME_DIR/ssh-agent-env" >/dev/null +fi + _is_running gpg-agent || { gpg-agent --daemon >"$XDG_RUNTIME_DIR/gpg-agent-env" } -_source "$XDG_RUNTIME_DIR/ssh-agent-env" >/dev/null _source "$XDG_RUNTIME_DIR/gpg-agent-env" >/dev/null