##// END OF EJS Templates
cleanup some closing logic...
cleanup some closing logic * Single prompt on quit event * Disabled leaving the kernel running on window close, as it doesn't make as much sense now that there are multiple kernel windows * Tabs respect confirm-exit setting * Removed some obsolete kwargs from MainWindow.__init__, that are no longer used Closing logic is still a bit wonky, depending on the ordering of tabs closed (masters, slaves, etc.). also fix some spelling errors, and remove errant semicolons

File last commit:

r4019:3c996c36
r5138:8b6601c2
Show More
daemonize.py
26 lines | 831 B | text/x-python | PythonLexer
"""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)
except OSError, e:
if e.errno != errno.EBADF:
raise
os.close(null)