diff --git a/.config/zsh/.zlogout b/.config/zsh/.zlogout index 002ff41..80d1216 100644 --- a/.config/zsh/.zlogout +++ b/.config/zsh/.zlogout @@ -1 +1,2 @@ -[[ -z $SSH_AGENT_PID ]] || kill "$SSH_AGENT_PID" +# Kill ssh-agent if it was created in this session +! (( LAUNCHED_SSH_AGENT && SSH_AGENT_PID )) || kill "$SSH_AGENT_PID" diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index c5bb44f..d3b77e9 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -48,6 +48,8 @@ fi # SSH if (( $+commands[ssh-agent] )) && [[ ! $SSH_AGENT_PID ]]; then eval "$(ssh-agent)" >/dev/null + # See .zlogout + LAUNCHED_SSH_AGENT=1 fi # Editor