From 5f8ba88f1666f62c9e3bc07f17f26bbf9e5187b5 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 5 Feb 2018 22:29:48 +0800 Subject: 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. --- _zsh/80-gpg.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to '_zsh/80-gpg.zsh') 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 -- cgit v1.2.2