]> code.ossystems Code Review - openembedded-core.git/commitdiff
qemurunner: convert data when working with socket
authorEd Bartosh <ed.bartosh@linux.intel.com>
Mon, 16 May 2016 15:40:39 +0000 (18:40 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 2 Jun 2016 07:10:03 +0000 (08:10 +0100)
Converted str to bytes before sending to socket.
Converted bytes to str after receiving from socket.

This should fix TypeError: 'str' does not support the buffer interface
for qemurunner.run_serial method.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/qemurunner.py

index c1d07d9b41f314f526cb5f21cb6951727fd63ce4..3d60433cae51148d6630949088e8918b23638371 100644 (file)
@@ -376,14 +376,14 @@ class QemuRunner:
 
         data = ''
         status = 0
-        self.server_socket.sendall(command)
+        self.server_socket.sendall(command.encode('utf-8'))
         keepreading = True
         while keepreading:
             sread, _, _ = select.select([self.server_socket],[],[],5)
             if sread:
                 answer = self.server_socket.recv(1024)
                 if answer:
-                    data += answer
+                    data += answer.decode('utf-8')
                     # Search the prompt to stop
                     if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
                         keepreading = False