[oe-commits] [bitbake] 02/03: bitbake-worker: don't reassign sys.stdout
git at git.openembedded.org
git at git.openembedded.org
Wed Jul 6 13:19:31 UTC 2016
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit 1966ad0d7af431ad371e4403ede0aea6dc090855
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Tue Jul 5 00:53:59 2016 +0300
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 at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
bin/bitbake-worker | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 5d062a2..963b4cd 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:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list