Handle OSError 6 when trying to read a socket in .ssh (#269)

Fixes #268
This commit is contained in:
Serge van Ginderachter 2019-04-25 06:32:43 +02:00 committed by Manuel Riel
parent a83ad6352e
commit 33c16d925f
1 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import os
import errno
import sys
import platform
import plistlib
@ -78,6 +79,12 @@ def get_private_keys():
available_private_keys.append(key_details)
except (SSHException, UnicodeDecodeError, IsADirectoryError):
continue
except OSError as e:
if e.errno == errno.ENXIO:
# when key_file is a (ControlPath) socket
continue
else:
raise
return available_private_keys