Dan Kenigsberg has uploaded a new change for review. Change subject: compat: py3: capture output of CPopen.communicate ......................................................................
compat: py3: capture output of CPopen.communicate To allow better coverage of python3 testing, we use Popen instead of CPopen, as the latter is not implemented (and not needed) in python3. Unfortunately, CPopen has chosen to use stdin=subprocess.PIPE as its default. vdsm.compat.CPopen must follow suit, or the process's output would not be returned by CPopen.communicate. Change-Id: Iac9c1c1bd3ca1902103fac1f8675b7d42ca78a33 Signed-off-by: Dan Kenigsberg <[email protected]> --- M lib/vdsm/compat.py 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/61393/1 diff --git a/lib/vdsm/compat.py b/lib/vdsm/compat.py index 8884005..414c193 100644 --- a/lib/vdsm/compat.py +++ b/lib/vdsm/compat.py @@ -44,8 +44,14 @@ from cpopen import CPopen CPopen # make pyflakes happy else: - from subprocess import Popen as CPopen - CPopen # make pyflakes happy + import subprocess + class CPopen(subprocess.Popen): + def __init__(self, args, **kwargs): + if 'stderr' not in kwargs: + kwargs['stderr'] = subprocess.PIPE + if 'stdout' not in kwargs: + kwargs['stdout'] = subprocess.PIPE + subprocess.Popen.__init__(self, args, **kwargs) try: from contextlib import suppress -- To view, visit https://gerrit.ovirt.org/61393 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac9c1c1bd3ca1902103fac1f8675b7d42ca78a33 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
