avoid TB for encoding in python3

527e60ba added method `run_command_print' to provide
buffered output during long-running commands.

This causes TB in python3 due to IO encoding issues, so for now...

* use getoutput instead of run_command_print
* add TODO in run_command_print to make it compatible asap
This commit is contained in:
Paul Morgan 2014-03-12 19:20:39 +00:00
parent ff5fd1faf7
commit 886df517fa
2 changed files with 3 additions and 3 deletions

View file

@ -19,7 +19,6 @@ and rpms.
import os
import sys
import re
import commands
import shutil
from pkg_resources import require
from distutils.version import LooseVersion as loose_version
@ -200,7 +199,7 @@ class BuilderBase(object):
' "_binary_filedigest_algorithm md5" %s %s %s --nodeps -bs %s' % (
rpmbuild_options, self._get_rpmbuild_dir_options(),
define_dist, self.spec_file))
output = run_command_print(cmd)
output = getoutput(cmd)
print(output)
self.srpm_location = find_wrote_in_rpmbuild_output(output)[0]
self.artifacts.append(self.srpm_location)
@ -223,7 +222,7 @@ class BuilderBase(object):
self._get_rpmbuild_dir_options(), define_dist, self.spec_file))
debug(cmd)
try:
output = run_command_print(cmd)
output = getoutput(cmd)
except (KeyboardInterrupt, SystemExit):
print("")
exit(1)

View file

@ -228,6 +228,7 @@ def run_command(command, print_on_success=False):
def run_command_print(command):
"""
Simliar to run_command but prints each line of output on the fly.
TODO: make this work in both python2 and python3.
"""
output = []
env = os.environ.copy()