sv_mgr.py 文件源码

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

项目:sv-mgr 作者: hristoast 项目源码 文件源码
def enable_sv(sv, sv_dir, runsvdir):
    """
    Enable the specified service, 'sv'.

    Assemble 'sv_path' and 'service_path' from 'sv', 'sv_dir', and 'runsvdir'.
    Make a symlink from 'sv_path' to 'service_path' and bail if we get one
    of a couple different exceptions.
    """
    sv_path = os.path.join(sv_dir, sv)
    service_path = os.path.join(runsvdir, sv)
    try:
        check_sv_path(sv_path)
        os.symlink(sv_path, service_path)
        return True
    except NoSuchSvError:
        raise NoSuchSvError
    except PermissionError:
        raise NeedSudoError
    except FileExistsError:
        raise SvAlreadyEnabledError
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号