[Zodb-checkins] CVS: ZODB3/zdaemon - zdaemon.py:1.6

Guido van Rossum guido@python.org
Mon, 11 Nov 2002 12:38:39 -0500


Update of /cvs-repository/ZODB3/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv28396

Modified Files:
	zdaemon.py 
Log Message:
In daemonize(), chdir to /, and use os._exit() instead of self.exit();
we don't want to remove the socket when the daemon parent exits.


=== ZODB3/zdaemon/zdaemon.py 1.5 => 1.6 ===
--- ZODB3/zdaemon/zdaemon.py:1.5	Mon Nov 11 11:53:51 2002
+++ ZODB3/zdaemon/zdaemon.py	Mon Nov 11 12:38:39 2002
@@ -62,8 +62,6 @@
 
 - Do the governor without actual sleeps, using event scheduling etc.
 
-- Change directory (where?) before starting the application
-
 - Add docstrings
 
 """
@@ -256,9 +254,10 @@
         if pid != 0:
             # Parent
             self.blather("daemon manager forked; parent exiting")
-            self.exit()
+            os._exit(0)
         # Child
         self.info("daemonizing the process")
+        os.chdir("/")
         os.close(0)
         sys.stdin = sys.__stdin__ = open("/dev/null")
         os.close(1)