fix issue #142. Thanks

This commit is contained in:
benoitc 2011-01-04 09:42:49 +01:00
parent 7436161800
commit cd726f6d8c
2 changed files with 6 additions and 8 deletions

View File

@ -3,6 +3,6 @@
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 12, 0)
version_info = (0, 12, 1)
__version__ = ".".join(map(str, version_info))
SERVER_SOFTWARE = "gunicorn/%s" % __version__

View File

@ -254,20 +254,18 @@ def is_hoppish(header):
def daemonize():
"""\
Standard daemonization of a process. Code is basd on the
ActiveState recipe at:
http://code.activestate.com/recipes/278731/
Standard daemonization of a process.
http://www.svbug.com/documentation/comp.unix.programmer-FAQ/faq_2.html#SEC16
"""
if not 'GUNICORN_FD' in os.environ:
if os.fork() == 0:
os.setsid()
if os.fork() != 0:
os.umask(0)
else:
if os.fork():
os._exit(0)
else:
os._exit(0)
os.umask(0)
maxfd = get_maxfd()
# Iterate through and close all file descriptors.