From bbc5ed60587fe774edde07a8fa62b14c3c01c0bb Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 7 Dec 2004 07:51:39 +0000 Subject: [PATCH] We apparently need these closes as well. Let's see if this fixes my bug. --- scripts/supybot | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/supybot b/scripts/supybot index 50662da0e..3dbeefe18 100755 --- a/scripts/supybot +++ b/scripts/supybot @@ -286,6 +286,14 @@ if __name__ == '__main__': sys.stderr.close() sys.stdout = StringIO.StringIO() sys.stderr = StringIO.StringIO() + # We have to be really methodical here. + os.close(0) + os.close(1) + os.close(2) + fd = os.open('/dev/null', os.RDWR) + os.dup2(fd, 0) + os.dup2(fd, 1) + os.dup2(fd, 2) signal.signal(signal.SIGHUP, signal.SIG_IGN) log.info('Completed daemonization. Current PID: %s', os.getpid())