From 26120ca18dd8c2567b0df5a533d52d53c4111bc2 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 16 Jun 2009 11:49:10 -0700 Subject: [PATCH] Don't crash if the ssh client is already dead If the SSH client terminated abnormally in the background (e.g. the server shutdown while we were doing a sync) then the pid won't exist. Instead of crashing, ignore it, the result we wanted (a non-orphaned ssh process) is already acheived. Signed-off-by: Shawn O. Pearce --- git_config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git_config.py b/git_config.py index d33c3b12..36e8d939 100644 --- a/git_config.py +++ b/git_config.py @@ -385,8 +385,11 @@ def _open_ssh(host, port): def close_ssh(): for key,p in _ssh_cache.iteritems(): - os.kill(p.pid, SIGTERM) - p.wait() + try: + os.kill(p.pid, SIGTERM) + p.wait() + catch OSError: + pass _ssh_cache.clear() d = _ssh_sock(create=False)