dockertty.py 文件源码

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

项目:dockertty 作者: JetMuffin 项目源码 文件源码
def kill_spawned_process(self):
        """
        Kill spawned process inside container.

        If process of `docker exec` was killed, the spawned process inside container is
        still running. So we should kill spawned process before kill `docker exec`.
        """
        p = PtyProcessUnicode.spawn(['docker', 'exec', self.container_id, '/bin/sh', '-c',
                                     'kill -1  $(cat /tmp/sh.pid.{})'.format(self.uuid)])
        # wait till complete execution of command
        while p.isalive():
            sleep(1)
        p.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号