basetest.py 文件源码

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

项目:protoc-gen-lua-bin 作者: u0u0 项目源码 文件源码
def __init__(self, stream, filename):
    self._stream = stream
    self._fd = stream.fileno()
    self._filename = filename

    # Keep original stream for later
    self._uncaptured_fd = os.dup(self._fd)

    # Open file to save stream to
    cap_fd = os.open(self._filename,
                     os.O_CREAT | os.O_TRUNC | os.O_WRONLY,
                     0600)

    # Send stream to this file
    self._stream.flush()
    os.dup2(cap_fd, self._fd)
    os.close(cap_fd)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号