()
Currently only implemented for Unix like systems.
Currently only implemented for Unix like systems.
Currently only implemented for Unix like systems .
def daemonize():
    """
    Currently only implemented for Unix like systems.
    """
    if platform.system() == 'Windows':
        raise Exception('Daemonizing is currently not supported on Windows.')
       
    if os.fork() == 0: 
        os.setsid()
        if os.fork():
            os._exit(0)
    else:
        os._exit(0)
                
    os.umask(0)
    maxfd = get_maxfd()

    # Iterate through and close all file descriptors.
    for fd in range(0, maxfd):
        try:
            os.close(fd)
        except OSError:	# ERROR, fd wasn't open to begin with (ignored)
            pass

    os.open(REDIRECT_TO, os.O_RDWR)
    os.dup2(0, 1)
    os.dup2(0, 2)
def daemonize ( ) : if platform . system ( ) == 'Windows' : raise Exception ( 'Daemonizing is currently not supported on Windows.' ) if os . fork ( ) == 0 : os . setsid ( ) if os . fork ( ) : os . _exit ( 0 ) else : os . _exit ( 0 ) os . umask ( 0 ) maxfd = get_maxfd ( ) # Iterate through and close all file descriptors. for fd in range ( 0 , maxfd ) : try : os . close ( fd ) except OSError : # ERROR, fd wasn't open to begin with (ignored) pass os . open ( REDIRECT_TO , os . O_RDWR ) os . dup2 ( 0 , 1 ) os . dup2 ( 0 , 2 )