aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-02-05 22:29:48 +0800
committerAaron LI <aly@aaronly.me>2018-02-05 22:29:48 +0800
commit5f8ba88f1666f62c9e3bc07f17f26bbf9e5187b5 (patch)
tree65b87a6dfc5da5f4773d1bb0fab93be3304fe440
parent0a78ecac74709ff02339ee2fc5843365639f3b4f (diff)
downloaddotfiles-5f8ba88f1666f62c9e3bc07f17f26bbf9e5187b5.tar.bz2
zsh/gpg: ignore agent error in preexec hook
For a NFS-shared-home cluster, once login to a node and start the gpg-agnet, then the original gpg-agent on the master will quit, which causes the annoying agent connection error. Simply ignore the error and do not try to launch the agent, which is of little use for the above cases.
-rw-r--r--_zsh/80-gpg.zsh5
1 files changed, 2 insertions, 3 deletions
diff --git a/_zsh/80-gpg.zsh b/_zsh/80-gpg.zsh
index e841d67..c0314d4 100644
--- a/_zsh/80-gpg.zsh
+++ b/_zsh/80-gpg.zsh
@@ -44,7 +44,7 @@ restart-gpg-agent() {
# * `gpg-agent(1)': option `--enable-ssh-support'
#
update-gpg-tty() {
- gpg-connect-agent updatestartuptty /bye >/dev/null
+ gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1
}
update-pinentry-app() {
@@ -57,8 +57,7 @@ update-pinentry-app() {
#
autoload -U add-zsh-hook
zsh-preexec() {
- update-gpg-tty
- update-pinentry-app
+ update-gpg-tty && update-pinentry-app || true
}
add-zsh-hook preexec zsh-preexec