##// END OF EJS Templates
zmqterminal subclasses TerminalInteractiveShell/IPApp...
zmqterminal subclasses TerminalInteractiveShell/IPApp this does a lot of the boiler plate for us, so Omar's communication code is used in place of run_cell / complete. Now colors, prompts, indentation, cl-args, etc. are all inherited from regular existing code. keyboard interrupts don't work yet, the kernel just dies...

File last commit:

r4019:3c996c36
r5600:8360d3a9
Show More
daemonize.py
26 lines | 831 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)
except OSError, e:
if e.errno != errno.EBADF:
raise
os.close(null)