Browse Source

Set default GPG_AGENT_PID for grep

If `GPG_AGENT_PID` is unset, grep will succeed if another gpg-agent is
running as it will match the string `gpg-agent` where the PID was an
empty string. Set a default value for grep to a value that will never
match if unset, i.e. -1.
master
Sorin Ionescu 10 years ago
parent
commit
ea25ccf62c
  1. 2
      modules/gpg/init.zsh

2
modules/gpg/init.zsh

@ -15,7 +15,7 @@ _gpg_agent_conf="$HOME/.gnupg/gpg-agent.conf"
_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env" _gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env"
# Start gpg-agent if not started. # Start gpg-agent if not started.
if ! ps -U "$USER" -o ucomm | grep -q gpg-agent; then if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${GPG_AGENT_PID:--1} gpg-agent"; then
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")" eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
else else
# Export environment variables. # Export environment variables.

Loading…
Cancel
Save