Log message for revision 30046: Port from Zope 2.7 branch. After consulting with Mark Hammond, removed the explicit calls to SvcStop(). That method gets invoked automatically by the services framework when a stop request is generated. Calling it explicitly too caused the onStop() method to get called multiple times. At least ZRS's Service subclasses have onStop() methods that can't be called multiple times without raising exceptions (they shut things down, and stuff like sockets go away the first time onStop() gets called).
Changed: U Zope/trunk/lib/python/nt_svcutils/service.py -=- Modified: Zope/trunk/lib/python/nt_svcutils/service.py =================================================================== --- Zope/trunk/lib/python/nt_svcutils/service.py 2005-04-19 15:05:49 UTC (rev 30045) +++ Zope/trunk/lib/python/nt_svcutils/service.py 2005-04-19 15:52:29 UTC (rev 30046) @@ -161,7 +161,7 @@ # XXX why the test before the log message? if self.backoff_interval > BACKOFF_INITIAL_INTERVAL: self.info("created process") - if not (self.run() and self.checkRestart()): + if not (self.run() and self.checkRestart()): break self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) @@ -206,7 +206,7 @@ win32api.TerminateProcess(self.hZope, 3) self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) - # Wait for the redirect thread - it should have died as the remote + # Wait for the redirect thread - it should have died as the remote # process terminated. # As we are shutting down, we do the join with a little more care, # reporting progress as we wait (even though we never will <wink>) @@ -234,7 +234,6 @@ win32event.INFINITE) if rc == win32event.WAIT_OBJECT_0: # user sent a stop service request - self.SvcStop() keep_running = False elif rc == win32event.WAIT_OBJECT_0 + 1: # user did not send a service stop request, but @@ -261,7 +260,6 @@ # this was an abormal shutdown. if self.backoff_cumulative > BACKOFF_MAX: self.error("restarting too frequently; quit") - self.SvcStop() return False self.warning("sleep %s to avoid rapid restarts" % self.backoff_interval) @@ -276,7 +274,7 @@ self.backoff_cumulative += self.backoff_interval self.backoff_interval *= 2 return True - + def createProcessCaptureIO(self, cmd): hInputRead, hInputWriteTemp = self.newPipe() hOutReadTemp, hOutWrite = self.newPipe() @@ -302,7 +300,7 @@ # problematic in general, but should work in the controlled # circumstances of a service process. create_flags = win32process.CREATE_NEW_CONSOLE - info = win32process.CreateProcess(None, cmd, None, None, True, + info = win32process.CreateProcess(None, cmd, None, None, True, create_flags, None, None, si) # (NOTE: these really aren't necessary for Python - they are closed # as soon as they are collected) _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins