mirror of
				https://github.com/dcarrillo/prezto.git
				synced 2025-11-04 09:49:08 +00:00 
			
		
		
		
	[Fix #689] Use GPG_AGENT_INFO instead of GPG_AGENT_PID
GPG_AGENT_PID may not be defined. Also, source gpg-agent.env before checking the PID.
This commit is contained in:
		@@ -15,11 +15,14 @@ _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 pid,ucomm | grep -q -- "${GPG_AGENT_PID:--1} gpg-agent"; then
 | 
					if [[ -z "$GPG_AGENT_INFO" ]]; then
 | 
				
			||||||
  eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
  # Export environment variables.
 | 
					  # Export environment variables.
 | 
				
			||||||
  source "$_gpg_agent_env" 2> /dev/null
 | 
					  source "$_gpg_agent_env" 2> /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Start gpg-agent if not started.
 | 
				
			||||||
 | 
					  if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
 | 
				
			||||||
 | 
					    eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Inform gpg-agent of the current TTY for user prompts.
 | 
					# Inform gpg-agent of the current TTY for user prompts.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user