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:55:39 +0100 |
commit | 732001cb268683f5b56e251e2964ec5b694a2147 (patch) | |
tree | adeff3343e2752f1324dbc60dbc11b3bb5f3811e /meta/classes/devshell.bbclass | |
parent | 875910451e1ce97d0c42b41b1140c8160ed1f40a (diff) | |
download | openembedded-core-732001cb268683f5b56e251e2964ec5b694a2147.tar.gz openembedded-core-732001cb268683f5b56e251e2964ec5b694a2147.tar.bz2 openembedded-core-732001cb268683f5b56e251e2964ec5b694a2147.zip |
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.
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): os.dup2(m, sys.stdout.fileno()) os.dup2(m, sys.stderr.fileno()) - sys.stdin = os.fdopen(sys.stdin.fileno(), 'r', 0) - bb.utils.nonblockingfd(sys.stdout) bb.utils.nonblockingfd(sys.stderr) bb.utils.nonblockingfd(sys.stdin) @@ -92,6 +90,7 @@ def devpyshell(d): else: prompt = ps1 sys.stdout.write(prompt) + sys.stdout.flush() # Restore Ctrl+C since bitbake masks this def signal_handler(signal, frame): @@ -113,6 +112,7 @@ def devpyshell(d): continue except EOFError as e: sys.stdout.write("\n") + sys.stdout.flush() except (OSError, IOError) as e: if e.errno == 11: continue |