[Zope-Checkins] CVS: ZODB3/ZEO/tests - zeoserver.py:1.19.6.4

Jeremy Hylton jeremy at zope.com
Mon Oct 6 23:41:58 EDT 2003


Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv13094

Modified Files:
      Tag: Zope-2_7-branch
	zeoserver.py 
Log Message:
Backport kill() to Zope-2_7-branch.


=== ZODB3/ZEO/tests/zeoserver.py 1.19.6.3 => 1.19.6.4 ===
--- ZODB3/ZEO/tests/zeoserver.py:1.19.6.3	Wed Sep 17 12:30:10 2003
+++ ZODB3/ZEO/tests/zeoserver.py	Mon Oct  6 23:41:57 2003
@@ -128,14 +128,26 @@
         # chance that the server gives up before the clients.
         time.sleep(330)
         log("zeoserver", "suicide thread invoking shutdown")
-        from ZEO.tests.forker import shutdown_zeo_server
-        # XXX If the -k option was given to zeoserver, then the process will
-        # go away but the temp files won't get cleaned up.
-        shutdown_zeo_server(self._adminaddr)
+        
+        # If the server hasn't shut down yet, the client may not be
+        # able to connect to it.  If so, try to kill the process to
+        # force it to shutdown.
+        if hasattr(os, "kill"):
+            os.kill(pid, signal.SIGTERM)
+            time.sleep(5)
+            os.kill(pid, signal.SIGKILL)
+        else:
+            from ZEO.tests.forker import shutdown_zeo_server
+            # XXX If the -k option was given to zeoserver, then the
+            # process will go away but the temp files won't get
+            # cleaned up.
+            shutdown_zeo_server(self._adminaddr)
 
 
 def main():
-    label = 'zeoserver:%d' % os.getpid()
+    global pid
+    pid = os.getpid()
+    label = 'zeoserver:%d' % pid
     log(label, 'starting')
 
     # We don't do much sanity checking of the arguments, since if we get it




More information about the Zope-Checkins mailing list