helpers.py 文件源码

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

项目:appetite 作者: Bridgewater 项目源码 文件源码
def run(cmd, working_dir=None, dry_run=False):
    """Runs local cmd command"""

    cmd_split = shlex.split(cmd) if isinstance(cmd, basestring) else cmd

    if dry_run:
        return " ".join(cmd_split), 0

    try:
        p = Popen(cmd_split, shell=False, stderr=STDOUT, stdout=PIPE, cwd=working_dir)

        communicate = p.communicate()

        return communicate[0].strip(), p.returncode
    except OSError as e:
        logger.errorout("Run OSError", error=e.message)
    except: # pylint: disable=bare-except
        logger.errorout("Run Error")

    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号