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 /meta/classes/devshell.bbclass | |
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 'meta/classes/devshell.bbclass')
-rw-r--r-- | meta/classes/devshell.bbclass | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass index 041ed15d46..be71aff35f 100644 --- a/meta/classes/devshell.bbclass +++ b/meta/classes/devshell.bbclass | |||
@@ -65,8 +65,6 @@ def devpyshell(d): | |||
65 | os.dup2(m, sys.stdout.fileno()) | 65 | os.dup2(m, sys.stdout.fileno()) |
66 | os.dup2(m, sys.stderr.fileno()) | 66 | os.dup2(m, sys.stderr.fileno()) |
67 | 67 | ||
68 | sys.stdin = os.fdopen(sys.stdin.fileno(), 'r', 0) | ||
69 | |||
70 | bb.utils.nonblockingfd(sys.stdout) | 68 | bb.utils.nonblockingfd(sys.stdout) |
71 | bb.utils.nonblockingfd(sys.stderr) | 69 | bb.utils.nonblockingfd(sys.stderr) |
72 | bb.utils.nonblockingfd(sys.stdin) | 70 | bb.utils.nonblockingfd(sys.stdin) |
@@ -92,6 +90,7 @@ def devpyshell(d): | |||
92 | else: | 90 | else: |
93 | prompt = ps1 | 91 | prompt = ps1 |
94 | sys.stdout.write(prompt) | 92 | sys.stdout.write(prompt) |
93 | sys.stdout.flush() | ||
95 | 94 | ||
96 | # Restore Ctrl+C since bitbake masks this | 95 | # Restore Ctrl+C since bitbake masks this |
97 | def signal_handler(signal, frame): | 96 | def signal_handler(signal, frame): |
@@ -113,6 +112,7 @@ def devpyshell(d): | |||
113 | continue | 112 | continue |
114 | except EOFError as e: | 113 | except EOFError as e: |
115 | sys.stdout.write("\n") | 114 | sys.stdout.write("\n") |
115 | sys.stdout.flush() | ||
116 | except (OSError, IOError) as e: | 116 | except (OSError, IOError) as e: |
117 | if e.errno == 11: | 117 | if e.errno == 11: |
118 | continue | 118 | continue |