command.py 文件源码

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

项目:cli-bdd 作者: chibisov 项目源码 文件源码
def run(command, fail_on_error=False, interactively=False):
    child = pexpect.spawn('/bin/sh', ['-c', command], echo=False)
    child.logfile_read = StringIO.StringIO()
    child.logfile_send = StringIO.StringIO()
    if not interactively:
        child.expect(pexpect.EOF)
        if fail_on_error and child.exitstatus > 0:
            raise Exception(
                '%s (exit code %s)' % (
                    child.logfile_read.getvalue(),
                    child.exitstatus
                )
            )
    return {
        'child': child,
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号