summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-07-05 00:53:59 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:57:06 +0100
commitb26bcff4c4d72775f1def7e769015464953b955c (patch)
treee26400a2830bd1ee855fb09b490fd8ba19cfb60f /bin
parent860475cfdd35301fb609ab3c89347566b0ca0adc (diff)
downloadbitbake-contrib-b26bcff4c4d72775f1def7e769015464953b955c.tar.gz
bitbake-contrib-b26bcff4c4d72775f1def7e769015464953b955c.tar.bz2
bitbake-contrib-b26bcff4c4d72775f1def7e769015464953b955c.zip
bitbake-worker: don't reassign sys.stdout
Worker needs input stream in binary mode as it reads binary content from it. Current code does it by detaching a buffer from sys.stdin and assigning it back to sys.stdin. Detached buffer is io.BufferedReader in binary mode. This operation is implicit as its purpose is not easily understandable from the code. Replacing it with fdopen(sys.stdin.fileno(), 'rb') should make the code more understandable. Assigning the buffer to sys.stdin is not needed as worker doesn't use sys.stdin. Moreover, it leads to difficult to debug issues down the stack. For example, devpyshell doesn't work without reopening sys.stdin in text mode. This is not needed anymore after this fix as sys.stdin is not changed in worker code and remains in text mode. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bitbake-worker3
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 5d062a23e9..963b4cdf93 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -436,8 +436,7 @@ class BitbakeWorker(object):
self.build_pipes[pipe].read()
try:
- sys.stdin = sys.stdin.detach()
- worker = BitbakeWorker(sys.stdin)
+ worker = BitbakeWorker(os.fdopen(sys.stdin.fileno(), 'rb'))
if not profiling:
worker.serve()
else: