Commit 97ba24ea authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* _startProcess() handles everything to guarantee starting process:

  * stop process if any
  * release port if used
  * test running soffice
* stop() does now crear working directories.

now cloudooo supports LibreOffice, that exits in status=81 at the very first invoking.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@42206 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9f3e70d4
...@@ -98,12 +98,17 @@ class OpenOffice(Application): ...@@ -98,12 +98,17 @@ class OpenOffice(Application):
def _startProcess(self, command, env): def _startProcess(self, command, env):
"""Start OpenOffice.org process""" """Start OpenOffice.org process"""
for i in range(5):
self.stop()
waitStopDaemon(self, self.timeout)
self.process = Popen(command, self.process = Popen(command,
close_fds=True, close_fds=True,
env=env) env=env)
returned_code = self.process.poll() returned_code = self.process.poll()
waitStartDaemon(self, self.timeout) if not waitStartDaemon(self, self.timeout):
return self._testOpenOffice(self.hostname, self.port) continue
if self._testOpenOffice(self.hostname, self.port):
return
def _releaseOpenOfficePort(self): def _releaseOpenOfficePort(self):
for process in psutil.process_iter(): for process in psutil.process_iter():
...@@ -150,12 +155,6 @@ class OpenOffice(Application): ...@@ -150,12 +155,6 @@ class OpenOffice(Application):
env["TMP"] = self.path_user_installation env["TMP"] = self.path_user_installation
env["TMPDIR"] = self.path_user_installation env["TMPDIR"] = self.path_user_installation
env["DISPLAY"] = ":%s" % self.display_id env["DISPLAY"] = ":%s" % self.display_id
if socketStatus(self.hostname, self.port):
self._releaseOpenOfficePort()
process_started = self._startProcess(self.command, env)
if not process_started:
self.stop()
waitStopDaemon(self, self.timeout)
self._startProcess(self.command, env) self._startProcess(self.command, env)
self._cleanRequest() self._cleanRequest()
Application.start(self) Application.start(self)
...@@ -166,8 +165,6 @@ class OpenOffice(Application): ...@@ -166,8 +165,6 @@ class OpenOffice(Application):
Application.stop(self) Application.stop(self)
if socketStatus(self.hostname, self.port): if socketStatus(self.hostname, self.port):
self._releaseOpenOfficePort() self._releaseOpenOfficePort()
if exists(self.path_user_installation):
removeDirectory(self.path_user_installation)
self._cleanRequest() self._cleanRequest()
def isLocked(self): def isLocked(self):
......
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