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:
parent
b0463e58d8
commit
d6df5c81fd
@ -243,7 +243,11 @@ class SshConnection(object):
|
|||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
logger.debug('Logging out {}@{}'.format(self.username, self.host))
|
logger.debug('Logging out {}@{}'.format(self.username, self.host))
|
||||||
|
try:
|
||||||
self.conn.logout()
|
self.conn.logout()
|
||||||
|
except:
|
||||||
|
logger.debug('Connection lost.')
|
||||||
|
self.conn.close(force=True)
|
||||||
|
|
||||||
def cancel_running_command(self):
|
def cancel_running_command(self):
|
||||||
# simulate impatiently hitting ^C until command prompt appears
|
# simulate impatiently hitting ^C until command prompt appears
|
||||||
|
Loading…
x
Reference in New Issue
Block a user