summaryrefslogtreecommitdiff
path: root/scripts/oepydevshell-internal.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-07-05 01:08:14 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:55:39 +0100
commit732001cb268683f5b56e251e2964ec5b694a2147 (patch)
treeadeff3343e2752f1324dbc60dbc11b3bb5f3811e /scripts/oepydevshell-internal.py
parent875910451e1ce97d0c42b41b1140c8160ed1f40a (diff)
downloadopenembedded-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 'scripts/oepydevshell-internal.py')
-rwxr-xr-xscripts/oepydevshell-internal.py4
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:
pty = open(sys.argv[1], "w+b", 0)
parent = int(sys.argv[2])
-# Don't buffer output by line endings
-sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
-sys.stdin = os.fdopen(sys.stdin.fileno(), 'r', 0)
nonblockingfd(pty)
nonblockingfd(sys.stdin)
@@ -64,6 +61,7 @@ try:
# Write a page at a time to avoid overflowing output
# d.keys() is a good way to do that
sys.stdout.write(i[:4096])
+ sys.stdout.flush()
i = i[4096:]
if sys.stdin in ready:
echonocbreak(sys.stdin.fileno())