Skip to contentSkip to conversation

oeqa/sshcontrol: Handle interrupted system call error

PATCH New Richard Purdie 1 participant 1 message Oct 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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
meta/lib/oeqa/utils/sshcontrol.py +0 -0
index da485ee..05d6502 100644
@@ -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: