[Zope-Checkins] CVS: Zope/lib/python/zdaemon - Daemon.py:1.4

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 11 Mar 2002 09:24:40 -0500


Update of /cvs-repository/Zope/lib/python/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv28544/lib/python/zdaemon

Modified Files:
	Daemon.py 
Log Message:
merge toby-daemon-file-close-branch: closing stdin/stdout/stderr when run as a daemon

=== Zope/lib/python/zdaemon/Daemon.py 1.3 => 1.4 ===
         if pid:
             sys.exit(0)
+        posix.close(0); sys.stdin  = open('/dev/null')
+        posix.close(1); sys.stdout = open('/dev/null','w')
+        posix.close(2); sys.stderr = open('/dev/null','w')
         posix.setsid()
 
     while 1: