diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-07-05 00:53:59 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:28 +0100 |
commit | 7ed76e4c2021ef96b3244dfca5ddb91a69c4c721 (patch) | |
tree | e406842faae83936c35d743bfba75456749d7e6b /bitbake/bin/bitbake-worker | |
parent | dab3b1b45486b2da0df23bd9e9715046a8a0515c (diff) | |
download | poky-7ed76e4c2021ef96b3244dfca5ddb91a69c4c721.tar.gz |
bitbake: 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.
(Bitbake rev: b26bcff4c4d72775f1def7e769015464953b955c)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/bitbake-worker')
-rwxr-xr-x | bitbake/bin/bitbake-worker | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index 5d062a23e9..963b4cdf93 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker | |||
@@ -436,8 +436,7 @@ class BitbakeWorker(object): | |||
436 | self.build_pipes[pipe].read() | 436 | self.build_pipes[pipe].read() |
437 | 437 | ||
438 | try: | 438 | try: |
439 | sys.stdin = sys.stdin.detach() | 439 | worker = BitbakeWorker(os.fdopen(sys.stdin.fileno(), 'rb')) |
440 | worker = BitbakeWorker(sys.stdin) | ||
441 | if not profiling: | 440 | if not profiling: |
442 | worker.serve() | 441 | worker.serve() |
443 | else: | 442 | else: |