diff options
author | Robey Pointer <robey@lag.net> | 2006-12-25 20:27:48 -0500 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2006-12-25 20:27:48 -0500 |
commit | db89be96ef56be4621902dafb221a5d8307d3ef0 (patch) | |
tree | d57188040b04632a335c11c71f5a3fb4fd8edd25 | |
parent | bc66f5eed2b5447834881304912aba1118e8712e (diff) |
[project @ robey@lag.net-20061226012748-lmbxlsue9q2jzk8x]
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.)
-rw-r--r-- | paramiko/agent.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/paramiko/agent.py b/paramiko/agent.py index b40a66d0..a01d3c1f 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -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) - conn.connect(os.environ['SSH_AUTH_SOCK']) + 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 |