rd.py 文件源码

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

项目:rubber-docker 作者: Fewbytes 项目源码 文件源码
def run(command):
    # TODO: replace this with fork()
    #       (https://docs.python.org/2/library/os.html#os.fork)
    pid = 0
    if pid == 0:
        # This is the child, we'll try to do some containment here
        try:
            contain(command)
        except Exception:
            traceback.print_exc()
            os._exit(1)  # something went wrong in contain()

    # This is the parent, pid contains the PID of the forked process
    # wait for the forked child and fetch the exit status
    _, status = os.waitpid(pid, 0)
    print('{} exited with status {}'.format(pid, status))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号