summaryrefslogtreecommitdiffstats
path: root/source-builder
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2020-03-30 10:46:38 +1100
committerChris Johns <chrisj@rtems.org>2020-03-30 10:46:38 +1100
commitfe63ad8777d597816e36867c3a8b265eaa660804 (patch)
tree93e53b1c7a34aadc68ba2c9f162854dc73f2e51e /source-builder
parent5/rtems-tools: Update to pick up rtems-test fixes for GDB (diff)
downloadrtems-source-builder-fe63ad8777d597816e36867c3a8b265eaa660804.tar.bz2
sb/execute: Port fixes from rtems-tools
Diffstat (limited to 'source-builder')
-rwxr-xr-xsource-builder/sb/execute.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/source-builder/sb/execute.py b/source-builder/sb/execute.py
index 0c25163..06f9b7d 100755
--- a/source-builder/sb/execute.py
+++ b/source-builder/sb/execute.py
@@ -128,12 +128,20 @@ class execute(object):
tmp = bytes('temp', sys.stdin.encoding)
except:
encoding = False
+ input_types = [str, bytes]
+ try:
+ # Unicode is not valid in python3, not added to the list
+ input_types += [unicode]
+ except:
+ pass
try:
while True:
if trace_threads:
print('execute:_writethread: call input', input)
lines = input()
- if type(lines) == str or type(lines) == bytes:
+ if trace_threads:
+ print('execute:_writethread: input returned:', type(lines))
+ if type(lines) in input_types:
try:
if encoding:
lines = bytes(lines, sys.stdin.encoding)
@@ -203,6 +211,9 @@ class execute(object):
sd = sd[:-1]
if len(sd) > 0:
for l in sd:
+ if trace_threads:
+ print('execute:_readthread: output-line:',
+ count, type(l))
_output_line(l + '\n', exe, prefix, out, count)
count += 1
if count > 10:
@@ -329,17 +340,19 @@ class execute(object):
timeout = None):
"""Open a command with arguments. Provide the arguments as a list or
a string."""
- if self.verbose:
- s = command
- if type(command) is list:
- def add(x, y): return x + ' ' + str(y)
- s = functools.reduce(add, command, '')[1:]
- what = 'spawn'
- if shell:
- what = 'shell'
- log.output(what + ': ' + s)
if self.output is None:
raise error.general('capture needs an output handler')
+ cs = command
+ if type(command) is list:
+ def add(x, y): return x + ' ' + str(y)
+ cs = functools.reduce(add, command, '')[1:]
+ what = 'spawn'
+ if shell:
+ what = 'shell'
+ cs = what + ': ' + cs
+ if self.verbose:
+ log.output(what + ': ' + cs)
+ log.trace('exe: %s' % (cs))
if shell and self.shell_exe:
command = arg_list(command)
command[:0] = self.shell_exe