Mercurial > templog
diff server/utils.py @ 66:c5ad12670cae
dup2 to devnull
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 26 Jun 2012 21:46:08 +0800 |
parents | b09c164debf6 |
children | 51d889ad39a3 |
line wrap: on
line diff
--- 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: