]> arthur.barton.de Git - ax-zsh.git/commitdiff
gnupg: Don't call tty(1), use the $TTY variable
authorAlexander Barton <alex@barton.de>
Fri, 16 Feb 2024 09:41:14 +0000 (10:41 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 16 Feb 2024 09:41:14 +0000 (10:41 +0100)
This fixes setting GPG_TTY when stdin is not a real terminal, for
example when using Powerlevel10k "instant prompt".

See <https://unix.stackexchange.com/questions/608842/zshrc-export-gpg-tty-tty-says-not-a-tty>.

plugins/gnupg/gnupg.zshrc

index 17d6dc5b8dbcd0a706f0e1276c1c1332a299137b..2b95624bd8e91d22746826ccc2567f8ab87844eb 100644 (file)
@@ -14,7 +14,7 @@ else
        (( $+commands[gpg] )) || return 1
 fi
 
-export GPG_TTY=$(tty)
+export GPG_TTY=$TTY
 
 if (( $+commands[gpg-connect-agent] )); then
        # Try to start/connect the agent ...