document the use of PYTHONUNBUFFERED in config

This commit is contained in:
benoitc 2013-04-23 15:34:34 +02:00
parent 32e4cf14df
commit 532d1fffaf
3 changed files with 3 additions and 25 deletions

View File

@ -93,9 +93,6 @@ class Arbiter(object):
if 'GUNICORN_FD' in os.environ:
self.log.reopen_files()
if self.cfg.enable_stdio_inheritance:
util.disable_stdout_buffering()
self.address = self.cfg.address
self.num_workers = self.cfg.workers
self.debug = self.cfg.debug

View File

@ -1305,4 +1305,7 @@ class EnableStdioInheritance(Setting):
Enable stdio inheritance
Enable inheritance for stdio file descriptors in daemon mode.
Note: To disable the python stdout buffering, you can to set the user
environment variable ``PYTHONUNBUFFERED`` .
"""

View File

@ -403,14 +403,6 @@ def is_hoppish(header):
return header.lower().strip() in hop_headers
def disable_stdout_buffering():
_old_write = sys.stdout.write
def _write(*args, **kwargs):
_old_write(*args, **kwargs)
sys.stdout.flush()
sys.stdout.write = _write
def daemonize(enable_stdio_inheritance=False):
"""\
Standard daemonization of a process.
@ -493,20 +485,6 @@ def daemonize(enable_stdio_inheritance=False):
redirect(sys.stdout, 1)
redirect(sys.stderr, 2)
# The aim is to disable buffering for stdout but
# this will fail if stdout is still the original
# Python C object as you cannot replace a method
# of a Python C object and it causes too many
# problems to replace sys.stdout and sys.stderr
# with wrappers around the originals as this is
# too late as things can have references to them.
# Better just to tell people to set the user
# environment variable PYTHONUNBUFFERED if this
# becomes an issue. Can't use C level setbuf()
# as Python doesn't expose that for file objects
# in any way.
#disable_stdout_buffering()
def seed():
try: