Commit 74256682 authored by Julien Muchembled's avatar Julien Muchembled

cloudooo: do not use 'Popen(shell=True, ...)'

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41310 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 89af0938
...@@ -59,14 +59,14 @@ class OpenOffice(Application): ...@@ -59,14 +59,14 @@ class OpenOffice(Application):
"""Test if OpenOffice was started correctly""" """Test if OpenOffice was started correctly"""
logger.debug("Test OpenOffice %s - Pid %s" % (self.getAddress()[-1], logger.debug("Test OpenOffice %s - Pid %s" % (self.getAddress()[-1],
self.pid())) self.pid()))
command = [join(self.office_binary_path, "python"), args = [join(self.office_binary_path, "python"),
pkg_resources.resource_filename("cloudooo", pkg_resources.resource_filename("cloudooo",
join("helper", "openoffice_tester.py")), join("helper", "openoffice_tester.py")),
"'--hostname=%s'" % host, "--hostname=%s" % host,
"'--port=%s'" % port, "--port=%s" % port,
"'--uno_path=%s'" % self.uno_path] "--uno_path=%s" % self.uno_path]
logger.debug("Testing Openoffice Instance %s" % port) logger.debug("Testing Openoffice Instance %s" % port)
stdout, stderr = Popen(" ".join(command), shell=True, stdout=PIPE, stdout, stderr = Popen(args, stdout=PIPE,
stderr=PIPE, close_fds=True).communicate() stderr=PIPE, close_fds=True).communicate()
stdout_bool = convertStringToBool(stdout.replace("\n", "")) stdout_bool = convertStringToBool(stdout.replace("\n", ""))
if stdout_bool and stderr != "": if stdout_bool and stderr != "":
......
...@@ -107,18 +107,17 @@ class MimeMapper(object): ...@@ -107,18 +107,17 @@ class MimeMapper(object):
uno_path = kw.get("uno_path", environ.get('uno_path')) uno_path = kw.get("uno_path", environ.get('uno_path'))
office_binary_path = kw.get("office_binary_path", office_binary_path = kw.get("office_binary_path",
environ.get('office_binary_path')) environ.get('office_binary_path'))
command = [path.join(office_binary_path, "python"), args = [path.join(office_binary_path, "python"),
pkg_resources.resource_filename(__name__, pkg_resources.resource_filename(__name__,
path.join("helper", "unomimemapper.py")), path.join("helper", "unomimemapper.py")),
"--uno_path='%s'" % uno_path, "--uno_path=%s" % uno_path,
"--office_binary_path='%s'" % office_binary_path, "--office_binary_path=%s" % office_binary_path,
"--hostname='%s'" % hostname, "--hostname=%s" % hostname,
"--port=%s" % port] "--port=%s" % port]
stdout, stderr = Popen(' '.join(command), stdout, stderr = Popen(args,
stdout=PIPE, stdout=PIPE,
close_fds=True, close_fds=True,
shell=True, env=getCleanPythonEnvironment()).communicate()
env=getCleanPythonEnvironment()).communicate()
exec(stdout) exec(stdout)
for key, value in filter_dict.iteritems(): for key, value in filter_dict.iteritems():
filter_name = key filter_name = key
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment