[OE-core] [PATCH] devtool: fix handling of unicode characters from subprocess stdout

Hu, Jiajie jiajie.hu at intel.com
Tue Nov 15 05:44:54 UTC 2016


I tried to follow the original implementation here. It seems that a simple read() is blocking and the output of the subprocess cannot be redirected in time. E.g., ‘Note: Fetching …’ is not shown until the unpack is finished.

From: Burton, Ross [mailto:ross.burton at intel.com]
Sent: Friday, November 11, 2016 8:22 PM
To: Hu, Jiajie <jiajie.hu at intel.com>
Cc: OE-core <openembedded-core at lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] devtool: fix handling of unicode characters from subprocess stdout


On 11 November 2016 at 06:02, Jiajie Hu <jiajie.hu at intel.com<mailto:jiajie.hu at intel.com>> wrote:
+    reader = codecs.getreader('utf-8')(process.stdout)
     buf = ''
     while True:
-        out = process.stdout.read(1)
-        out = out.decode('utf-8')
+        out = reader.read(1, 1)

A reader is definitely the right thing here, but I'm wondering why this needs to loop on single characters.  As I understand it doing a read() on a reader wrapping stdout will read until it blocks (because the process hasn't got anything to output) so result in less pointless iterating.

Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20161115/19217101/attachment-0002.html>


More information about the Openembedded-core mailing list