diff options
author | Justin Ross <jross@apache.org> | 2016-04-21 23:22:05 +0000 |
---|---|---|
committer | Justin Ross <jross@apache.org> | 2016-04-21 23:22:05 +0000 |
commit | 6292f19f873f6dd09ea0d49583ebd911aaf8b7f9 (patch) | |
tree | 26c99ecee36f9afc6e6a4ac66f9c67e38c376338 | |
parent | aa92704be9e608a3437858ce9e9ced9a22e49f1f (diff) | |
download | qpid-python-6292f19f873f6dd09ea0d49583ebd911aaf8b7f9.tar.gz |
QPID-7207: Avoid use of Popen with shell=True; on some platforms it prevents process termination
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1740427 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/tests/common.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/qpid/cpp/src/tests/common.py b/qpid/cpp/src/tests/common.py index 9c898e3087..606f3784c1 100644 --- a/qpid/cpp/src/tests/common.py +++ b/qpid/cpp/src/tests/common.py @@ -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 |