Commit cf2a7922 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to prevent OSError exception and make possible retry the conversion

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41928 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dae3ce51
...@@ -90,12 +90,10 @@ class OOHandler: ...@@ -90,12 +90,10 @@ class OOHandler:
"""start the Monitor""" """start the Monitor"""
self.monitor = MonitorTimeout(openoffice, self.timeout) self.monitor = MonitorTimeout(openoffice, self.timeout)
self.monitor.start() self.monitor.start()
return
def _stopTimeout(self): def _stopTimeout(self):
"""stop the Monitor""" """stop the Monitor"""
self.monitor.terminate() self.monitor.terminate()
return
def _subprocess(self, command): def _subprocess(self, command):
"""Run one procedure""" """Run one procedure"""
...@@ -107,7 +105,11 @@ class OOHandler: ...@@ -107,7 +105,11 @@ class OOHandler:
stderr=PIPE, stderr=PIPE,
close_fds=True) close_fds=True)
stdout, stderr = process.communicate() stdout, stderr = process.communicate()
except OSError, e:
self.monitor = process = None
stdout, stderr = "", "OSError: %s" % e
finally: finally:
if self.monitor is not None and process is not None:
self._stopTimeout() self._stopTimeout()
if pid_exists(process.pid): if pid_exists(process.pid):
process.terminate() process.terminate()
......
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