summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2009-01-30 11:25:25 +0100
committerHugues Hiegel <hugues@hiegel.fr>2009-01-30 11:25:25 +0100
commit1d11c8d26b289ca1c900255df6c49f38767c78cf (patch)
treefdde58db4fefb38fcaac9eb743120bff7e988701
parent0dfcb165d38197e60126cf9e720ec254fc26ad24 (diff)
[PROMPT] better managment of agents if they have been killed
-rw-r--r--12_Prompts.zsh14
1 files changed, 10 insertions, 4 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 88bdef8..123211a 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -95,13 +95,19 @@ update_prompt()
# GPG/SSH agents
AGENTS=""
- if [ "$SSH_AGENT_PID" -gt 0 -a "`strings /proc/$SSH_AGENT_PID/cmdline | head -n1`" = "ssh-agent" ]
+ if [ "$SSH_AGENT_PID" -gt 0 -a -e /proc/$SSH_AGENT_PID/cmdline ]
then
- AGENTS=$SEPARATOR$C_$prompt_colors[agents]$_C"★"
+ [ "`strings /proc/$SSH_AGENT_PID/cmdline | head -n1`" = "ssh-agent" ] && \
+ AGENTS=$SEPARATOR$C_$prompt_colors[agents]$_C"★"
fi
- if [ "$GPG_AGENT_INFO" != "" -a "`strings /proc/$(echo $GPG_AGENT_INFO | cut -d: -f2)/cmdline | head -n1`" = "gpg-agent" ]
+ if [ "$GPG_AGENT_INFO" != "" ]
then
- AGENTS=$AGENTS$SEPARATOR$C_$prompt_colors[agents]$_C"☆"
+ GPG_AGENT_PID="$(echo $GPG_AGENT_INFO | cut -d: -f2)"
+ if [ -e /proc/$GPG_AGENT_PID/cmdline ]
+ then
+ [ "`strings /proc/$GPG_AGENT_PID/cmdline | head -n1`" = "gpg-agent" ] && \
+ AGENTS=$AGENTS$SEPARATOR$C_$prompt_colors[agents]$_C"☆"
+ fi
fi
AGENTSSIZE=$(expand_text $AGENTS)
AGENTSSIZE=$#AGENTSSIZE