conftest.py 文件源码

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

项目:makemkv 作者: Robpol86 项目源码 文件源码
def cdload(path=None):
    """Load the ISO into the virtual CD-ROM device.

    :param path: File path of ISO file to load if not sample.iso.
    """
    path = path or 'sample.iso'

    try:
        run(['cdemu', 'load', '0', path])
    except subprocess.CalledProcessError as exc:
        if b'AlreadyLoaded' not in exc.stderr:
            raise
        loaded = cdstatus()
        if not loaded or os.path.realpath(loaded) != os.path.realpath(path):
            cdunload()
            return cdload(path)

    for _ in range(50):
        if os.path.exists('/dev/cdrom'):
            return
        time.sleep(0.1)
    if not os.path.exists('/dev/cdrom'):
        raise IOError('Failed to load cdemu device!')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号