Browse Source

fix(ssh-agent): don't start new agent if screen/tmux symlink exists (#12297)

Alexander Schlüter 1 month ago
parent
commit
3e05befaee
1 changed files with 4 additions and 2 deletions
  1. 4 2
      plugins/ssh-agent/ssh-agent.plugin.zsh

+ 4 - 2
plugins/ssh-agent/ssh-agent.plugin.zsh

@@ -98,8 +98,10 @@ function _add_identities() {
 
 # Add a nifty symlink for screen/tmux if agent forwarding is enabled
 if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
-   && [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then
-  ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+   && [[ -n "$SSH_AUTH_SOCK" ]]; then
+  if [[ ! -L "$SSH_AUTH_SOCK" ]]; then
+    ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+  fi
 else
   _start_agent
 fi