[FIX] win32: use 'net' command for service start/stop operation
authorXavier ALT <xal@openerp.com>
Mon, 7 Jan 2013 16:23:02 +0000 (17:23 +0100)
committerXavier ALT <xal@openerp.com>
Mon, 7 Jan 2013 16:23:02 +0000 (17:23 +0100)
  * We have to wait for complete service stop before trying to re-start
    OpenERP service, otherwise service manager will complain that the
    service is already running - and thus preventing to it start.
      'sc' command only send a query to service manager without waiting
    for completion - instead we use 'net' command which wait for complete
    start/stop operation.

bzr revid: xal@openerp.com-20130107162302-xtf44nm10859203w

openerp/service/__init__.py

index 307ee4a..c95e35d 100644 (file)
@@ -130,7 +130,7 @@ def start_services_workers():
 def _reexec():
     """reexecute openerp-server process with (nearly) the same arguments"""
     if openerp.tools.osutil.is_running_as_nt_service():
-        subprocess.call('sc stop {0} && sc start {0}'.format(nt_service_name), shell=True)
+        subprocess.call('net stop {0} && net start {0}'.format(nt_service_name), shell=True)
     exe = os.path.basename(sys.executable)
     strip_args = ['-d', '-u']
     a = sys.argv[:]