oeqa/sshcontrol: Handle interrupted system call error

Deal with an interrupted system call gracefully:

|   File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-qa-systemd/build/meta/lib/oeqa/utils/sshcontrol.py", line 55, in _run
|     if select.select([self.process.stdout], [], [], 5)[0] != []:
| InterruptedError: [Errno 4] Interrupted system call

(From OE-Core rev: 556125e4004fb7ac5169b59f51dc151f18c1806a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2016-10-03 15:56:13 +01:00
parent 3c1faa13cf
commit 78c01995e3
1 changed files with 13 additions and 11 deletions

View File

@ -52,17 +52,19 @@ class SSHProcess(object):
endtime = self.starttime + timeout
eof = False
while time.time() < endtime and not eof:
if select.select([self.process.stdout], [], [], 5)[0] != []:
data = os.read(self.process.stdout.fileno(), 1024)
if not data:
self.process.stdout.close()
eof = True
else:
data = data.decode("utf-8")
output += data
self.log(data)
endtime = time.time() + timeout
try:
if select.select([self.process.stdout], [], [], 5)[0] != []:
data = os.read(self.process.stdout.fileno(), 1024)
if not data:
self.process.stdout.close()
eof = True
else:
data = data.decode("utf-8")
output += data
self.log(data)
endtime = time.time() + timeout
except InterruptedError:
continue
# process hasn't returned yet
if not eof: