Workaround for twisted stupidity.

This commit is contained in:
Jeremy Fincher 2005-02-28 20:08:46 +00:00
parent 1c56071e19
commit 0016b4ff21

View File

@ -113,6 +113,12 @@ def upkeep():
# log.warning it (things shouldn't be printed, and we're more likely # log.warning it (things shouldn't be printed, and we're more likely
# to get bug reports if we make it a warning). # to get bug reports if we make it a warning).
assert not type(sys.stdout) == file, 'Not a StringIO object!' assert not type(sys.stdout) == file, 'Not a StringIO object!'
if not hasattr(sys.stdout, 'getvalue'):
# Stupid twisted sometimes replaces our stdout with theirs, because
# "The Twisted Way Is The Right Way" (ha!). So we're stuck simply
# returning.
log.warning('Expected cStringIO as stdout, got %r.', sys.stdout)
return
s = sys.stdout.getvalue() s = sys.stdout.getvalue()
if s: if s:
log.warning('Printed to stdout after daemonization: %s', s) log.warning('Printed to stdout after daemonization: %s', s)