Commit f741c9fb authored by Jérome Perrin's avatar Jérome Perrin

ooo: fix slow startup

On first soffice start with an empty profile, the process
immediatly exits with returncode 81 - this is confirmed in
https://bugs.documentfoundation.org/show_bug.cgi?id=107912 and
not really a bug. This bug suggest running with soffice, but
this seems not really needed for us, because we expect that
libreoffice may crash and we restart it in that case.

Problem is that util.waitStartDaemon(process) does not check
if process is still running, so if the process terminates we
have to wait for the timeout.

This changes waitStartDaemon to check for terminated process
in every iteration and to stop waiting when process is
terminated.

waitStopDaemon is also changed to make use of the new hasExited
method for consistency.
parent 27d76c56
......@@ -104,3 +104,9 @@ class Application(object):
if not hasattr(self, 'process'):
return None
return self.process.pid
def hasExited(self):
"""Check if process has exited running"""
if not hasattr(self, 'process'):
return True
return self.process.poll() is not None
......@@ -61,7 +61,7 @@ def waitStartDaemon(daemon, attempts):
for num in range(attempts):
if daemon.status():
return True
elif daemon.pid() is None:
elif daemon.hasExited():
return False
sleep(1)
return False
......@@ -70,7 +70,7 @@ def waitStartDaemon(daemon, attempts):
def waitStopDaemon(daemon, attempts=5):
"""Wait a certain time to stop the daemon."""
for num in range(attempts):
if not daemon.status():
if not daemon.status() or daemon.hasExited():
return True
sleep(1)
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