load_utils.py 文件源码

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

项目:pheweb 作者: statgen 项目源码 文件源码
def run_script(script):
    script = 'set -euo pipefail\n' + script
    try:
        with open(os.devnull) as devnull:
            # is this the right way to block stdin?
            data = subprocess.check_output(['bash', '-c', script], stderr=subprocess.STDOUT, stdin=devnull)
        status = 0
    except subprocess.CalledProcessError as ex:
        data = ex.output
        status = ex.returncode
    data = data.decode('utf8')
    if status != 0:
        raise PheWebError(
            'FAILED with status {}\n'.format(status) +
            'output was:\n' +
            data)
    return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号