]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/sshcontrol: Handle empty reads
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 24 Jan 2025 15:26:25 +0000 (15:26 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 25 Jan 2025 11:29:59 +0000 (11:29 +0000)
Looking at some of the autobuilder failures, it seems that somehow empty
reads might be possible despite not being EOF. Tweak the code to be a little
more robust in handling this.

In theory this shouldn't be possible but python does handle signals a bit
differently (e.g. transparrently retrying syscalls for EINTR) so adding this
check and a bit of code safety at least rules out this problem.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/sshcontrol.py

index 36c2ecb3dba8cd2dc97a59fc6294ff1540ff29fe..6c5648779a54127e09a8ae3b1541ed6dc4ade2bd 100644 (file)
@@ -57,8 +57,10 @@ class SSHProcess(object):
                     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
+                            self.process.poll()
+                            if self.process.returncode is None:
+                                self.process.stdout.close()
+                                eof = True
                         else:
                             data = data.decode("utf-8")
                             output += data