From 69c7c76e3aaac3ceeeba46511006033e0192dbb1 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 20 Apr 2004 09:42:20 +0000 Subject: [PATCH] Added another handler for daemonized...we're getting pretty close, we just need to actually daemonize :) --- src/world.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/world.py b/src/world.py index 6b7033743..aa105386a 100644 --- a/src/world.py +++ b/src/world.py @@ -91,6 +91,17 @@ def upkeep(scheduleNext=True): pass if gc.garbage: log.warning('Uncollectable garbage: %s', gc.garbage) + if conf.daemonized: + # If we're daemonized, sys.stdout has been replaced with a StringIO + # object, so let's see if anything's been printed, and if so, let's + # log.warning it (things shouldn't be printed, and we're more likely + # to get bug reports if we make it a warning). + assert not type(sys.stdout) == file, 'Not a StringIO object!' + s = sys.stdout.getvalue() + if s: + log.warning('Printed to stdout after daemonization: %s', s) + sys.stdout.reset() + sys.stdout.truncate() flushed = conf.supybot.flush() and not starting if flushed: flush()