[Zope-Checkins] CVS: ZODB3/ZEO - start.py:1.47

Guido van Rossum guido@python.org
Tue, 8 Oct 2002 16:14:36 -0400


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

Modified Files:
	start.py 
Log Message:
Unlink the zeo_pid file at the end.  This is how it was in the olden
days.  At least the script zeostart.py did this, and it was a clone of
ZEO1/start.py except for that added feature.  Our sysadmin desperately
wants that feature.


=== ZODB3/ZEO/start.py 1.46 => 1.47 ===
--- ZODB3/ZEO/start.py:1.46	Mon Oct  7 17:15:52 2002
+++ ZODB3/ZEO/start.py	Tue Oct  8 16:14:36 2002
@@ -263,7 +263,9 @@
         except:
             pass # getpid not supported
         else:
-            open(env.zeo_pid,'w').write("%s %s\n" % (ppid, pid))
+            f = open(env.zeo_pid, 'w')
+            f.write("%s %s\n" % (ppid, pid))
+            f.close()
 
     except:
         # Log startup exception and tell zdaemon not to restart us.
@@ -279,7 +281,11 @@
         sys.exit(0)
 
     try:
-        asyncore.loop()
+        try:
+            asyncore.loop()
+        finally:
+            if os.path.isfile(env.zeo_pid):
+                os.unlink(env.zeo_pid)
     except SystemExit:
         raise
     except: