From d3cf99666cc683f01dffb6d97d89d1c6b08b3a4c Mon Sep 17 00:00:00 2001 From: romkatv Date: Mon, 2 Mar 2020 09:27:40 +0100 Subject: [PATCH] use $TTY instead of $(tty); it's faster and more reliable `tty` command infers the current TTY from file descriptor 0. `$TTY` gives current TTY directly. The latter works even when file descriptor 0 is redirected. It's also over 1000 times faster. --- modules/gpg/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gpg/init.zsh b/modules/gpg/init.zsh index 7976fd7..4498b7b 100644 --- a/modules/gpg/init.zsh +++ b/modules/gpg/init.zsh @@ -26,7 +26,7 @@ if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; fi # Inform gpg-agent of the current TTY for user prompts. -export GPG_TTY="$(tty)" +export GPG_TTY=$TTY # Integrate with the SSH module. if grep '^enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then