diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-07-05 01:08:14 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:23 +0100 |
| commit | e8feb1976a04d0a0850fc316cfff390d0569ec4a (patch) | |
| tree | d2edd76d8b2ce659411449c0541d44e406646a1c /scripts/oepydevshell-internal.py | |
| parent | 250955ab8c9b67a43e9cb6dc1f837bbca5141705 (diff) | |
| download | poky-e8feb1976a04d0a0850fc316cfff390d0569ec4a.tar.gz | |
devpyshell: python3: flush stdout explicitly
Opening text stream in unbuffered mode raises the following
exception In Python 3:
ValueError: can't have unbuffered text I/O
Fixed by leaving std* streams in text mode and flushing
stdout explicitly.
(From OE-Core rev: 732001cb268683f5b56e251e2964ec5b694a2147)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oepydevshell-internal.py')
| -rwxr-xr-x | scripts/oepydevshell-internal.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/scripts/oepydevshell-internal.py b/scripts/oepydevshell-internal.py index 7761f667ef..31a75ac29f 100755 --- a/scripts/oepydevshell-internal.py +++ b/scripts/oepydevshell-internal.py | |||
| @@ -29,9 +29,6 @@ if len(sys.argv) != 3: | |||
| 29 | pty = open(sys.argv[1], "w+b", 0) | 29 | pty = open(sys.argv[1], "w+b", 0) |
| 30 | parent = int(sys.argv[2]) | 30 | parent = int(sys.argv[2]) |
| 31 | 31 | ||
| 32 | # Don't buffer output by line endings | ||
| 33 | sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) | ||
| 34 | sys.stdin = os.fdopen(sys.stdin.fileno(), 'r', 0) | ||
| 35 | nonblockingfd(pty) | 32 | nonblockingfd(pty) |
| 36 | nonblockingfd(sys.stdin) | 33 | nonblockingfd(sys.stdin) |
| 37 | 34 | ||
| @@ -64,6 +61,7 @@ try: | |||
| 64 | # Write a page at a time to avoid overflowing output | 61 | # Write a page at a time to avoid overflowing output |
| 65 | # d.keys() is a good way to do that | 62 | # d.keys() is a good way to do that |
| 66 | sys.stdout.write(i[:4096]) | 63 | sys.stdout.write(i[:4096]) |
| 64 | sys.stdout.flush() | ||
| 67 | i = i[4096:] | 65 | i = i[4096:] |
| 68 | if sys.stdin in ready: | 66 | if sys.stdin in ready: |
| 69 | echonocbreak(sys.stdin.fileno()) | 67 | echonocbreak(sys.stdin.fileno()) |
