From bec3abd64c3f7594b1db27fc25ff3a2e759ed01d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 26 Nov 2012 13:22:20 +0100 Subject: [PATCH] [FIX] restart of server on windows bzr revid: chs@openerp.com-20121126122220-38s3hla3hyl1b15p --- openerp/service/__init__.py | 10 +++++++--- 1 file 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)