helpers.py 文件源码

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

项目:libiocage 作者: iocage 项目源码 文件源码
def exec_iter(
    command: typing.List[str],
    logger: typing.Optional[iocage.lib.Logger.Logger]=None
) -> typing.Generator[str, None, None]:

    process = exec_raw(
        command,
        logger=logger,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        universal_newlines=True
    )

    for stdout_line in iter(process.stdout.readline, ""):
        yield stdout_line

    process.stdout.close()

    return_code = process.wait()
    if return_code:
        raise subprocess.CalledProcessError(return_code, command)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号