cli.py 文件源码

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

项目:simdem 作者: Azure 项目源码 文件源码
def get_shell(self):
        """Gets or creates the shell in which to run commands for the
        supplied demo
        """
        if self._shell == None:
            child = pexpect.spawnu('/bin/bash', env=self.demo.env.get(), echo=False, timeout=None)
            ps1 = PEXPECT_PROMPT[:5] + u'\[\]' + PEXPECT_PROMPT[5:]
            ps2 = PEXPECT_CONTINUATION_PROMPT[:5] + u'\[\]' + PEXPECT_CONTINUATION_PROMPT[5:]
            prompt_change = u"PS1='{0}' PS2='{1}' PROMPT_COMMAND=''".format(ps1, ps2)
            self._shell = pexpect.replwrap.REPLWrapper(child, u'\$', prompt_change)
        return self._shell
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号