utils.py 文件源码

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

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def _proceed_exec_result(out, err, ret_code, check_retcode):
    err, out = force_unicode(err), force_unicode(out)

    msg_parts = [
        (Fore.RED if ret_code else Fore.GREEN, 'RetCode: ', str(ret_code)),
        (Fore.BLUE, '=== StdOut ===\n', out),
        (Fore.RED if err else Fore.GREEN, '=== StdErr ===\n', err)]
    msg = '\n'.join(u'{}{}{}'.format(c, n, v) for c, n, v in msg_parts if v)

    LOG.debug(msg + Style.RESET_ALL)
    if check_retcode and ret_code != 0:
        raise NonZeroRetCodeException(
            stdout=out, stderr=err, ret_code=ret_code)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号