test_daemonize_unix.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:py_daemoniker 作者: Muterra 项目源码 文件源码
def childproc_filialusurp(umask, chdir, umask_path, sid_path, wdir_path,
                          pid_path):
    _filial_usurpation(chdir, umask)
    # Get our session id
    my_pid = os.getpid()
    sid = os.getsid(my_pid)
    # reset umask and get our set one.
    umask = os.umask(0)
    # Get our working directory.
    wdir = os.path.abspath(os.getcwd())

    # Update parent
    # Write the umask to the response path
    with open(umask_path, 'w') as f:
        f.write(str(umask) + '\n')

    # Write the sid to the response path
    with open(sid_path, 'w') as f:
        f.write(str(sid) + '\n')

    # Write the working dir to the response path
    with open(wdir_path, 'w') as f:
        f.write(wdir + '\n')

    # Write the pid to the response path
    with open(pid_path, 'w') as f:
        f.write(str(my_pid) + '\n')


# ###############################################
# Testing
# ###############################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号