Skip to content

Commit

Permalink
use $TTY instead of $(tty); it's faster and more reliable
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
romkatv authored and Stefan Rajkovic committed Apr 26, 2021
1 parent 2ab9157 commit 2150aa1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/gpg/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2150aa1

Please sign in to comment.