summaryrefslogtreecommitdiffstats
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):
42 with open(self.logfile, "a") as f: 42 with open(self.logfile, "a") as f:
43 f.write("%s" % msg) 43 f.write("%s" % msg)
44 44
45 def run(self, command, timeout=None, logfile=None): 45 def _run(self, command, timeout=None, logfile=None):
46 self.logfile = logfile 46 self.logfile = logfile
47 self.starttime = time.time() 47 self.starttime = time.time()
48 output = '' 48 output = ''
@@ -79,8 +79,18 @@ class SSHProcess(object):
79 79
80 self.status = self.process.wait() 80 self.status = self.process.wait()
81 self.output = output.rstrip() 81 self.output = output.rstrip()
82 return (self.status, self.output)
83 82
83 def run(self, command, timeout=None, logfile=None):
84 try:
85 self._run(command, timeout, logfile)
86 except:
87 # Need to guard against a SystemExit or other exception occuring whilst running
88 # and ensure we don't leave a process behind.
89 if self.process.poll() is None:
90 self.process.kill()
91 self.status = self.process.wait()
92 raise
93 return (self.status, self.output)
84 94
85class SSHControl(object): 95class SSHControl(object):
86 def __init__(self, ip, logfile=None, timeout=300, user='root', port=None): 96 def __init__(self, ip, logfile=None, timeout=300, user='root', port=None):