Commit 9f3e70d4 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* if pid is None, waitStartDaemon immediately returns False.

* wait 1 second after checking instead of before checking.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@42205 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1e7a2c2c
...@@ -57,18 +57,20 @@ def socketStatus(hostname, port): ...@@ -57,18 +57,20 @@ def socketStatus(hostname, port):
def waitStartDaemon(daemon, attempts): def waitStartDaemon(daemon, attempts):
"""Wait a certain time to start the daemon.""" """Wait a certain time to start the daemon."""
for num in range(attempts): for num in range(attempts):
sleep(1)
if daemon.status(): if daemon.status():
return True return True
elif daemon.pid() is None:
return False
sleep(1)
return False return False
def waitStopDaemon(daemon, attempts=5): def waitStopDaemon(daemon, attempts=5):
"""Wait a certain time to stop the daemon.""" """Wait a certain time to stop the daemon."""
for num in range(attempts): for num in range(attempts):
sleep(1)
if not daemon.status(): if not daemon.status():
return True return True
sleep(1)
return False return False
......
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