mirror of
https://git.yoctoproject.org/poky
synced 2026-03-11 17:59:39 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
250955ab8c
commit
e8feb1976a
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user