summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2012-11-26 13:22:20 +0100
committerChristophe Simonis <chs@openerp.com>2012-11-26 13:22:20 +0100
commitbec3abd64c3f7594b1db27fc25ff3a2e759ed01d (patch)
tree333cbf29319c9d8eb76ee7cc6b2a0f695478f276
parent452d1af646d1200b849cece156a1f6fce65acf6c (diff)
[FIX] restart of server on windows
bzr revid: chs@openerp.com-20121126122220-38s3hla3hyl1b15p
-rw-r--r--openerp/service/__init__.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/openerp/service/__init__.py b/openerp/service/__init__.py
index 60c3fc8474e..f34ef0c9461 100644
--- a/openerp/service/__init__.py
+++ b/openerp/service/__init__.py
@@ -129,6 +129,7 @@ def start_services_workers():
def _reexec():
"""reexecute openerp-server process with (nearly) the same arguments"""
+ # TODO check if parent is a NT service
strip_args = ['-d', '-u']
a = sys.argv[:]
args = [x for i, x in enumerate(a) if x not in strip_args and a[max(i - 1, 0)] not in strip_args]
@@ -141,9 +142,12 @@ def restart_server():
os.kill(pid, signal.SIGHUP)
else:
if os.name == 'nt':
- # TODO check if parent is a service
- stop_services()
- _reexec()
+ def reborn():
+ stop_services()
+ _reexec()
+
+ # run in a thread to let the current thread return response to the caller.
+ threading.Thread(target=reborn).start()
else:
openerp.phoenix = True
os.kill(os.getpid(), signal.SIGINT)