summaryrefslogtreecommitdiff
path: root/rtemstoolkit
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2018-11-26 10:01:53 +1100
committerChris Johns <chrisj@rtems.org>2018-11-26 14:36:44 +1100
commitaf5cecfff0f49355e7ca8f0cb33156959c3f067e (patch)
treeeae2b87b3a298f67fe75d023d9a95df852217360 /rtemstoolkit
parent71cede05ae2cdd2f5162ea7aea9ee0d50452f04f (diff)
rtemstoolkit: Fixes to the reader and writer threads for capturing
- Use the 'read1' file handle call to return if any data is queued for reading from stdout or stderr. - Flush the stdin pipe in the writer thread. These changes let the execute module work on Python2 and Python3.
Diffstat (limited to 'rtemstoolkit')
-rwxr-xr-xrtemstoolkit/execute.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/rtemstoolkit/execute.py b/rtemstoolkit/execute.py
index eb3c8c2..d509664 100755
--- a/rtemstoolkit/execute.py
+++ b/rtemstoolkit/execute.py
@@ -148,6 +148,7 @@ class execute(object):
if encoding:
lines = bytes(lines, sys.stdin.encoding)
fh.write(lines)
+ fh.flush()
except:
break
if lines == None or \
@@ -193,12 +194,12 @@ class execute(object):
# and the process is shutting down.
#
try:
- data = fh.read(4096)
+ data = fh.read1(4096)
except:
data = ''
if len(data) == 0:
if len(line) > 0:
- _output_line(l + '\n', exe, prefix, out, count)
+ _output_line(line + '\n', exe, prefix, out, count)
break
# str and bytes are the same type in Python2
if type(data) is not str and type(data) is bytes: