[test] Fix printing subprocess error messages

Decode the string as Python 3 returns bytes string, and also don’t
assume that it ends with a new line.
This commit is contained in:
Khaled Hosny 2018-09-22 16:41:56 +02:00
parent 403019482b
commit b7f1bbc2f8

View File

@ -9,7 +9,7 @@ def cmd(command):
p = subprocess.Popen (
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.wait ()
print (p.stderr.read (), end="") # file=sys.stderr
print (p.stderr.read ().decode ("utf-8").strip ()) # file=sys.stderr
return p.stdout.read ().decode ("utf-8").strip (), p.returncode