Commit a897c700 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code and run server without shell argument

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41774 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 125b1901
...@@ -12,17 +12,17 @@ from subprocess import Popen ...@@ -12,17 +12,17 @@ from subprocess import Popen
ENVIRONMENT_PATH = path.abspath(path.dirname(__file__)) ENVIRONMENT_PATH = path.abspath(path.dirname(__file__))
def wait_liberate_port(hostname, port, timeout_limit=10): def wait_liberate_port(hostname, port, timeout_limit=30):
for n in range(timeout_limit): for n in range(timeout_limit):
if not socketStatus(hostname, port): if not socketStatus(hostname, port):
break break
sleep(1) sleep(1)
def wait_use_port(hostname, port, timeout_limit=10): def wait_use_port(hostname, port, timeout_limit=30):
for n in range(timeout_limit): for n in range(timeout_limit):
if socketStatus(hostname, port): if socketStatus(hostname, port):
return break
sleep(1) sleep(1)
...@@ -94,18 +94,18 @@ def run(): ...@@ -94,18 +94,18 @@ def run():
hostname = config.get("app:main", "application_hostname") hostname = config.get("app:main", "application_hostname")
server_port = int(config.get("server:main", "port")) server_port = int(config.get("server:main", "port"))
run_dir = config.get('app:main', 'working_path') run_dir = config.get('app:main', 'working_path')
if DAEMON: if DAEMON:
loadConfig(server_cloudooo_conf) loadConfig(server_cloudooo_conf)
command = [paster_path, "serve", server_cloudooo_conf] command = [paster_path, "serve", server_cloudooo_conf]
process = Popen(" ".join(command), shell=True) process = Popen(command)
wait_use_port(hostname, openoffice_port)
wait_use_port(hostname, server_port) wait_use_port(hostname, server_port)
chdir(ENVIRONMENT_PATH) chdir(ENVIRONMENT_PATH)
try: try:
run_test(test_name) run_test(test_name)
finally: finally:
process.send_signal(1) process.send_signal(1)
sleep(3) wait_liberate_port(hostname, server_port)
process.terminate() process.terminate()
wait_liberate_port(hostname, server_port) wait_liberate_port(hostname, server_port)
elif OPENOFFICE: elif OPENOFFICE:
......
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