You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jr...@apache.org on 2016/05/11 18:45:26 UTC
svn commit: r1743410 - /qpid/trunk/qpid/cpp/src/tests/plano.py
Author: jross
Date: Wed May 11 18:45:26 2016
New Revision: 1743410
URL: http://svn.apache.org/viewvc?rev=1743410&view=rev
Log:
QPID-7207: Make call_for_output Python 2.6 compatible
Modified:
qpid/trunk/qpid/cpp/src/tests/plano.py
Modified: qpid/trunk/qpid/cpp/src/tests/plano.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/plano.py?rev=1743410&r1=1743409&r2=1743410&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/plano.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/plano.py Wed May 11 18:45:26 2016
@@ -414,12 +414,12 @@ def _init_call(command, args, kwargs):
return command, kwargs
def call(command, *args, **kwargs):
- command, args = _init_call(command, args, kwargs)
+ command, kwargs = _init_call(command, args, kwargs)
_subprocess.check_call(command, **kwargs)
def call_for_output(command, *args, **kwargs):
- command, args = _init_call(command, args, kwargs)
- return _subprocess.check_output(command, **kwargs)
+ command, kwargs = _init_call(command, args, kwargs)
+ return _subprocess_check_output(command, **kwargs)
def make_archive(input_dir, output_dir, archive_stem):
temp_dir = make_temp_dir()
@@ -541,3 +541,19 @@ def _copytree(src, dst, symlinks=False,
errors.append((src, dst, str(why)))
if errors:
raise _shutil.Error(errors)
+
+# For Python 2.6 compatibility
+def _subprocess_check_output(command, **kwargs):
+ kwargs["stdout"] = _subprocess.PIPE
+
+ proc = _subprocess.Popen(command, **kwargs)
+ output = proc.communicate()[0]
+ exit_code = proc.poll()
+
+ if exit_code not in (None, 0):
+ error = _subprocess.CalledProcessError(exit_code, command)
+ error.output = output
+
+ raise error
+
+ return output
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org