3e05befaeee60a0f8522f470292c75046b05ceb9
- Author
- Alexander Schlüter <alx.schlueter@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
fix(ssh-agent): don't start new agent if screen/tmux symlink exists (#12297)
Diff
1diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
2index 49ad95a11896561e8156db20ca51e829113b4ab3..77c422ce124e258afa45fdc7829011831c11ce0e 100644
3--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
4+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
5@@ -98,8 +98,10 @@ function _add_identities() {
6
7 # Add a nifty symlink for screen/tmux if agent forwarding is enabled
8 if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
9- && [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then
10- ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
11+ && [[ -n "$SSH_AUTH_SOCK" ]]; then
12+ if [[ ! -L "$SSH_AUTH_SOCK" ]]; then
13+ ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
14+ fi
15 else
16 _start_agent
17 fi