From 101ea872326211830e90d2bd01bd8506673f9d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 8 Sep 2019 16:07:06 +0200 Subject: [PATCH] ssh-agent: check if `ssh-add -l` was successful --- plugins/ssh-agent/ssh-agent.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 9471ff49c..6ab041c21 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -12,7 +12,7 @@ function _start_agent() { } function _add_identities() { - local id line sig + local id line sig lines local -a identities loaded_sigs loaded_ids not_loaded zstyle -a :omz:plugins:ssh-agent identities identities @@ -32,10 +32,12 @@ function _add_identities() { fi # get list of loaded identities' signatures and filenames - for line in ${(f)"$(ssh-add -l)"}; do - loaded_sigs+=${${(z)line}[2]} - loaded_ids+=${${(z)line}[3]} - done + if lines=$(ssh-add -l); then + for line in ${(f)lines}; do + loaded_sigs+=${${(z)line}[2]} + loaded_ids+=${${(z)line}[3]} + done + fi # add identities if not already loaded for id in $identities; do