Преглед на файлове

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 <sop@google.com>
Shawn O. Pearce преди 16 години
родител
ревизия
26120ca18d
променени са 1 файла, в които са добавени 5 реда и са изтрити 2 реда
  1. 5 2
      git_config.py

+ 5 - 2
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)