From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dan.rpsys.net (5751f4a1.skybroadband.com [87.81.244.161]) by mail.openembedded.org (Postfix) with ESMTP id B0087719B6 for ; Mon, 3 Oct 2016 14:56:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u93EuIGD013677 for ; Mon, 3 Oct 2016 15:56:18 +0100 Received: from dan.rpsys.net ([127.0.0.1]) by localhost (dan.rpsys.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rlaFwlqzCDDO for ; Mon, 3 Oct 2016 15:56:18 +0100 (BST) Received: from hex ([192.168.3.34]) (authenticated bits=0) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u93EuDqs013673 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 3 Oct 2016 15:56:14 +0100 Message-ID: <1475506573.30475.331.camel@linuxfoundation.org> From: Richard Purdie To: openembedded-core Date: Mon, 03 Oct 2016 15:56:13 +0100 X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Subject: [PATCH] oeqa/sshcontrol: Handle interrupted system call error X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2016 14:56:18 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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 Signed-off-by: Richard Purdie diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py index da485ee..05d6502 100644 --- a/meta/lib/oeqa/utils/sshcontrol.py +++ b/meta/lib/oeqa/utils/sshcontrol.py @@ -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: