aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/sshcontrol.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/sshcontrol.py')
-rw-r--r--meta/lib/oeqa/utils/sshcontrol.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py
index 6ed48badc8..00f5051053 100644
--- a/meta/lib/oeqa/utils/sshcontrol.py
+++ b/meta/lib/oeqa/utils/sshcontrol.py
@@ -42,7 +42,7 @@ class SSHProcess(object):
with open(self.logfile, "a") as f:
f.write("%s" % msg)
- def run(self, command, timeout=None, logfile=None):
+ def _run(self, command, timeout=None, logfile=None):
self.logfile = logfile
self.starttime = time.time()
output = ''
@@ -79,8 +79,18 @@ class SSHProcess(object):
self.status = self.process.wait()
self.output = output.rstrip()
- return (self.status, self.output)
+ def run(self, command, timeout=None, logfile=None):
+ try:
+ self._run(command, timeout, logfile)
+ except:
+ # Need to guard against a SystemExit or other exception occuring whilst running
+ # and ensure we don't leave a process behind.
+ if self.process.poll() is None:
+ self.process.kill()
+ self.status = self.process.wait()
+ raise
+ return (self.status, self.output)
class SSHControl(object):
def __init__(self, ip, logfile=None, timeout=300, user='root', port=None):