From 262ca045dbaef82145f04cc8ee8db4582bce9c5f Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 13 Oct 2008 23:30:45 +0200 Subject: [PATCH] Bugfix in the NT Service bzr revid: stephane@tinyerp.com-20081013213045-as7jsps8tvbrkv4s --- win32/OpenERPServerService.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/win32/OpenERPServerService.py b/win32/OpenERPServerService.py index 85cd884a839..f6f071bc082 100644 --- a/win32/OpenERPServerService.py +++ b/win32/OpenERPServerService.py @@ -73,15 +73,13 @@ class OpenERPServerService(win32serviceutil.ServiceFramework): def StartTERP(self): - # The server finds now its configuration automatically on Windows - # We start the ERP Server as an independent process, but we keep its handle - # The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix) - service_dir = os.path.dirname(sys.argv[0]) - server_dir = os.path.split(service_dir)[0] - server_path = os.path.join(server_dir, 'openerp-server.exe') - self.terpprocess = subprocess.Popen([server_path], \ - cwd=server_dir, - creationflags=win32process.CREATE_NO_WINDOW) + # The server finds now its configuration automatically on Windows + # We start the ERP Server as an independent process, but we keep its handle + # The server's binary must be one directory above the service's binary (when py2exe'd the python libraries shouldn' mix) + service_dir = os.path.dirname(sys.argv[0]) + server_dir = os.path.split(service_dir)[0] + server_path = os.path.join(server_dir, 'openerp-server.exe') + self.terpprocess = subprocess.Popen([server_path], cwd=server_dir, creationflags=win32process.CREATE_NO_WINDOW) def StartControl(self,ws): @@ -93,13 +91,13 @@ class OpenERPServerService(win32serviceutil.ServiceFramework): # Start OpenERP Server itself self.StartTERP() # start the loop waiting for the Service Manager's stop signal - thread.start_new_thread(self.StartControl, (self.hWaitStop,)) - # Log a info message that the server is running - servicemanager.LogInfoMsg("OpenERP Server up and running") - # verification if the server is really running, else quit with an error - self.terpprocess.wait() - if not self.stopping: - sys.exit("OpenERP Server check: server not running, check the logfile for more info") + thread.start_new_thread(self.StartControl, (self.hWaitStop,)) + # Log a info message that the server is running + servicemanager.LogInfoMsg("OpenERP Server up and running") + # verification if the server is really running, else quit with an error + self.terpprocess.wait() + if not self.stopping: + sys.exit("OpenERP Server check: server not running, check the logfile for more info")