def daemonize():

    if IS_WINDOWS:
        raise RuntimeError('Daemonizing is not supported on Windows.')

    if os.fork():
        os._exit(0)
    os.setsid()

    if os.fork():
        os._exit(0)

    os.umask(0)
    maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
    if (maxfd == resource.RLIM_INFINITY):
        maxfd = MAXFD
    closerange(0, maxfd)

    os.open(REDIRECT_TO, os.O_RDWR)
    os.dup2(0, 1)
    os.dup2(0, 2)
Makes a unique (random) bytestring name, starting with the given prefix.
dataset/ETHPy150Open benoitc/gaffer/gaffer/util.py/daemonize--crossover with--dataset/ETHPy150Open ViDA-NYU/reprozip/reprounzip/reprounzip/unpackers/common/misc.py/make_unique_name