##// END OF EJS Templates
check the static path for build and install locations...
check the static path for build and install locations allows packages to run the tests during package build and install time where the two file locations might be split.

File last commit:

r7787:28b538a9
r14749:c25f5524
Show More
daemonize.py
26 lines | 833 B | text/x-python | PythonLexer
MinRK
scrub twisted/deferred references from launchers...
r4019 """daemonize function from twisted.scripts._twistd_unix."""
#-----------------------------------------------------------------------------
# Copyright (c) Twisted Matrix Laboratories.
# See Twisted's LICENSE for details.
# http://twistedmatrix.com/
#-----------------------------------------------------------------------------
import os, errno
def daemonize():
# See http://www.erlenstar.demon.co.uk/unix/faq_toc.html#TOC16
if os.fork(): # launch child and...
os._exit(0) # kill off parent
os.setsid()
if os.fork(): # launch child and...
os._exit(0) # kill off parent again.
null = os.open('/dev/null', os.O_RDWR)
for i in range(3):
try:
os.dup2(null, i)
Matthias BUSSONNIER
conform to pep 3110...
r7787 except OSError as e:
MinRK
scrub twisted/deferred references from launchers...
r4019 if e.errno != errno.EBADF:
raise
os.close(null)