Commit 101ea872 authored by Marc Cornellà's avatar Marc Cornellà
Browse files

ssh-agent: check if `ssh-add -l` was successful

parent c44569f0
...@@ -12,7 +12,7 @@ function _start_agent() { ...@@ -12,7 +12,7 @@ function _start_agent() {
} }
function _add_identities() { function _add_identities() {
local id line sig local id line sig lines
local -a identities loaded_sigs loaded_ids not_loaded local -a identities loaded_sigs loaded_ids not_loaded
zstyle -a :omz:plugins:ssh-agent identities identities zstyle -a :omz:plugins:ssh-agent identities identities
...@@ -32,10 +32,12 @@ function _add_identities() { ...@@ -32,10 +32,12 @@ function _add_identities() {
fi fi
# get list of loaded identities' signatures and filenames # get list of loaded identities' signatures and filenames
for line in ${(f)"$(ssh-add -l)"}; do if lines=$(ssh-add -l); then
loaded_sigs+=${${(z)line}[2]} for line in ${(f)lines}; do
loaded_ids+=${${(z)line}[3]} loaded_sigs+=${${(z)line}[2]}
done loaded_ids+=${${(z)line}[3]}
done
fi
# add identities if not already loaded # add identities if not already loaded
for id in $identities; do for id in $identities; do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment