1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/ssh: Force connection to be closed if logout is unsuccessful

If the connection is unavailable when attempting the logout procure it
can fail leaving the connection open on the host. Now if something goes
wrong ensure that we still close the connection.
This commit is contained in:
Marc Bonnici 2018-08-20 11:16:09 +01:00 committed by setrofim
parent b0463e58d8
commit d6df5c81fd

View File

@ -243,7 +243,11 @@ class SshConnection(object):
def close(self):
logger.debug('Logging out {}@{}'.format(self.username, self.host))
try:
self.conn.logout()
except:
logger.debug('Connection lost.')
self.conn.close(force=True)
def cancel_running_command(self):
# simulate impatiently hitting ^C until command prompt appears