forked from OSchip/llvm-project
[lldbtest] Fix some code to be compatible between py2 and py3.
llvm-svn: 354297
This commit is contained in:
parent
1dbc72185a
commit
05709acba4
|
@ -438,27 +438,13 @@ def system(commands, **kwargs):
|
||||||
stdout=PIPE,
|
stdout=PIPE,
|
||||||
stderr=PIPE,
|
stderr=PIPE,
|
||||||
shell=True,
|
shell=True,
|
||||||
universal_newlines=True,
|
#encoding="utf-8",
|
||||||
|
#universal_newlines=True,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
pid = process.pid
|
pid = process.pid
|
||||||
this_output, this_error = process.communicate()
|
this_output, this_error = process.communicate()
|
||||||
retcode = process.poll()
|
retcode = process.poll()
|
||||||
|
|
||||||
# Enable trace on failure return while tracking down FreeBSD buildbot
|
|
||||||
# issues
|
|
||||||
trace = traceAlways
|
|
||||||
if not trace and retcode and sys.platform.startswith("freebsd"):
|
|
||||||
trace = True
|
|
||||||
|
|
||||||
with recording(test, trace) as sbuf:
|
|
||||||
print(file=sbuf)
|
|
||||||
print("os command:", shellCommand, file=sbuf)
|
|
||||||
print("with pid:", pid, file=sbuf)
|
|
||||||
print("stdout:", this_output, file=sbuf)
|
|
||||||
print("stderr:", this_error, file=sbuf)
|
|
||||||
print("retcode:", retcode, file=sbuf)
|
|
||||||
print(file=sbuf)
|
|
||||||
|
|
||||||
if retcode:
|
if retcode:
|
||||||
cmd = kwargs.get("args")
|
cmd = kwargs.get("args")
|
||||||
if cmd is None:
|
if cmd is None:
|
||||||
|
@ -471,8 +457,8 @@ def system(commands, **kwargs):
|
||||||
"command": shellCommand
|
"command": shellCommand
|
||||||
}
|
}
|
||||||
raise cpe
|
raise cpe
|
||||||
output = output + this_output
|
output = output + this_output.decode("utf-8")
|
||||||
error = error + this_error
|
error = error + this_error.decode("utf-8")
|
||||||
return (output, error)
|
return (output, error)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue