externalconsoledriver.py 文件源码

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

项目:labgrid 作者: labgrid-project 项目源码 文件源码
def open(self):
        """Starts the subprocess, does nothing if it is already closed"""
        if self.status:
            return
        cmd = shlex.split(self.cmd)
        self._child = subprocess.Popen(
            cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None
        )

        # make stdout non-blocking
        stdout_fd = self._child.stdout.fileno()
        stdout_fl = fcntl.fcntl(stdout_fd, fcntl.F_GETFL) | os.O_NONBLOCK
        fcntl.fcntl(stdout_fd, fcntl.F_SETFL, stdout_fl)

        # prepare for timeout handing
        self._poll = select.poll()
        self._poll.register(self._child.stdout.fileno())
        self.status = 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号