mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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>
This commit is contained in:
parent
7da73d6f3b
commit
26120ca18d
@ -385,8 +385,11 @@ def _open_ssh(host, port):
|
|||||||
|
|
||||||
def close_ssh():
|
def close_ssh():
|
||||||
for key,p in _ssh_cache.iteritems():
|
for key,p in _ssh_cache.iteritems():
|
||||||
|
try:
|
||||||
os.kill(p.pid, SIGTERM)
|
os.kill(p.pid, SIGTERM)
|
||||||
p.wait()
|
p.wait()
|
||||||
|
catch OSError:
|
||||||
|
pass
|
||||||
_ssh_cache.clear()
|
_ssh_cache.clear()
|
||||||
|
|
||||||
d = _ssh_sock(create=False)
|
d = _ssh_sock(create=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user