mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb/execute: Port fixes from rtems-tools
This commit is contained in:
parent
097018a8e4
commit
fe63ad8777
@ -128,12 +128,20 @@ class execute(object):
|
|||||||
tmp = bytes('temp', sys.stdin.encoding)
|
tmp = bytes('temp', sys.stdin.encoding)
|
||||||
except:
|
except:
|
||||||
encoding = False
|
encoding = False
|
||||||
|
input_types = [str, bytes]
|
||||||
|
try:
|
||||||
|
# Unicode is not valid in python3, not added to the list
|
||||||
|
input_types += [unicode]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
if trace_threads:
|
if trace_threads:
|
||||||
print('execute:_writethread: call input', input)
|
print('execute:_writethread: call input', input)
|
||||||
lines = 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:
|
try:
|
||||||
if encoding:
|
if encoding:
|
||||||
lines = bytes(lines, sys.stdin.encoding)
|
lines = bytes(lines, sys.stdin.encoding)
|
||||||
@ -203,6 +211,9 @@ class execute(object):
|
|||||||
sd = sd[:-1]
|
sd = sd[:-1]
|
||||||
if len(sd) > 0:
|
if len(sd) > 0:
|
||||||
for l in sd:
|
for l in sd:
|
||||||
|
if trace_threads:
|
||||||
|
print('execute:_readthread: output-line:',
|
||||||
|
count, type(l))
|
||||||
_output_line(l + '\n', exe, prefix, out, count)
|
_output_line(l + '\n', exe, prefix, out, count)
|
||||||
count += 1
|
count += 1
|
||||||
if count > 10:
|
if count > 10:
|
||||||
@ -329,17 +340,19 @@ class execute(object):
|
|||||||
timeout = None):
|
timeout = None):
|
||||||
"""Open a command with arguments. Provide the arguments as a list or
|
"""Open a command with arguments. Provide the arguments as a list or
|
||||||
a string."""
|
a string."""
|
||||||
if self.verbose:
|
if self.output is None:
|
||||||
s = command
|
raise error.general('capture needs an output handler')
|
||||||
|
cs = command
|
||||||
if type(command) is list:
|
if type(command) is list:
|
||||||
def add(x, y): return x + ' ' + str(y)
|
def add(x, y): return x + ' ' + str(y)
|
||||||
s = functools.reduce(add, command, '')[1:]
|
cs = functools.reduce(add, command, '')[1:]
|
||||||
what = 'spawn'
|
what = 'spawn'
|
||||||
if shell:
|
if shell:
|
||||||
what = 'shell'
|
what = 'shell'
|
||||||
log.output(what + ': ' + s)
|
cs = what + ': ' + cs
|
||||||
if self.output is None:
|
if self.verbose:
|
||||||
raise error.general('capture needs an output handler')
|
log.output(what + ': ' + cs)
|
||||||
|
log.trace('exe: %s' % (cs))
|
||||||
if shell and self.shell_exe:
|
if shell and self.shell_exe:
|
||||||
command = arg_list(command)
|
command = arg_list(command)
|
||||||
command[:0] = self.shell_exe
|
command[:0] = self.shell_exe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user