win32.py 文件源码

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

项目:ptterm 作者: jonathanslenders 项目源码 文件源码
def add_input_ready_callback(self, callback):
        """
        Add a new callback to be called for when there's input ready to read.
        """
        def poll():
            while True:
                try:
                    status, from_pipe = win32file.ReadFile(self.stdout_handle, 65536)
                except Exception:
                    # The pipe has ended.
                    self.ready_f.set_result(None)
                    return

                result = from_pipe.decode('utf-8', 'ignore')
                self._buffer.append(result)
                self.loop.call_from_executor(callback)

        self.loop.run_in_executor(poll, _daemon=True)
        return

        self._input_ready_callbacks.append(callback)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号