Author: jross
Date: Thu Apr 21 23:22:05 2016
New Revision: 1740427
URL: http://svn.apache.org/viewvc?rev=1740427&view=rev
Log:
QPID-7207: Avoid use of Popen with shell=True; on some platforms it prevents
process termination
Modified:
qpid/trunk/qpid/cpp/src/tests/common.py
Modified: qpid/trunk/qpid/cpp/src/tests/common.py
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/common.py?rev=1740427&r1=1740426&r2=1740427&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/common.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/common.py Thu Apr 21 23:22:05 2016
@@ -25,9 +25,10 @@ import atexit as _atexit
import os as _os
import platform as _platform
import re as _re
+import shlex as _shlex
+import shutil as _shutil
import signal as _signal
import subprocess as _subprocess
-import shutil as _shutil
import time as _time
import uuid as _uuid
@@ -115,22 +116,22 @@ class _Broker(object):
command = [
"qpidd",
- "--port 0",
- "--interface localhost",
+ "--port", "0",
+ "--interface", "localhost",
"--no-module-dir",
- "--log-enable info+",
- "--log-source yes",
- "--log-to-stderr no",
- "--log-to-file {0}".format(self.log_file),
- "--config {0}".format(_broker_config_file),
- "--data-dir {0}".format(self.data_dir),
+ "--log-enable", "info+",
+ "--log-source", "yes",
+ "--log-to-stderr", "no",
+ "--log-to-file", self.log_file,
+ "--config", _broker_config_file,
+ "--data-dir", self.data_dir,
]
if WINDOWS:
command += [
- "--ssl-cert-store-location LocalMachine",
- "--ssl-cert-name localhost",
- "--ssl-port 0",
+ "--ssl-cert-store-location", "LocalMachine",
+ "--ssl-cert-name", "localhost",
+ "--ssl-port", "0",
]
command += [x for x in args if x is not None]
@@ -143,8 +144,10 @@ class _Broker(object):
notice("Calling '{0}'", self.command)
write(self.command_file, self.command)
- self.proc = _subprocess.Popen(self.command, shell=True,
- stdout=_subprocess.PIPE)
+ # XXX Workaround for problem terminating subprocesses that use
shell=True
+ command_args = _shlex.split(self.command)
+
+ self.proc = _subprocess.Popen(command_args, stdout=_subprocess.PIPE)
self.port = self._wait_for_port()
assert self.command is not None
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]