if connecting to the agent fails, assume it's just not there, and don't
raise an exception.  (suggestion from martin pool on bazaar-dev.)
This commit is contained in:
Robey Pointer 2006-12-25 20:27:48 -05:00
parent bc66f5eed2
commit db89be96ef
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ class Agent:
self.keys = ()
if ('SSH_AUTH_SOCK' in os.environ) and (sys.platform != 'win32'):
conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
conn.connect(os.environ['SSH_AUTH_SOCK'])
except:
# probably a dangling env var: the ssh agent is gone
return
self.conn = conn
elif sys.platform == 'win32':
import win_pageant