# HG changeset patch # User Matt Johnston # Date 1340718368 -28800 # Node ID c5ad12670cae28759466d509ad724d1606468969 # Parent b09c164debf6ace859b22bc1a6e9af2040d65778 dup2 to devnull diff -r b09c164debf6 -r c5ad12670cae server/ts.py --- a/server/ts.py Tue Jun 26 21:36:54 2012 +0800 +++ b/server/ts.py Tue Jun 26 21:46:08 2012 +0800 @@ -25,6 +25,7 @@ import config from utils import monotonic_time, retry, readline, crc16 +import utils lightblue = None try: diff -r b09c164debf6 -r c5ad12670cae server/utils.py --- a/server/utils.py Tue Jun 26 21:36:54 2012 +0800 +++ b/server/utils.py Tue Jun 26 21:46:08 2012 +0800 @@ -99,6 +99,13 @@ return crc def cheap_daemon(): + print "Daemonising." + sys.stdout.flush() + sys.stderr.flush() + out = file('/dev/null', 'a+') + os.dup2(out.fileno(), sys.stdout.fileno()) + os.dup2(out.fileno(), sys.stderr.fileno()) + try: pid = os.fork() if pid > 0: