shells.py 文件源码

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

项目:hatch 作者: ofek 项目源码 文件源码
def xonsh_shell(exe_dir, shell_path):
    if ON_WINDOWS:
        result = subprocess.run(
            [shell_path or 'xonsh', '-i', '-D',
             'VIRTUAL_ENV={}'.format(os.path.dirname(exe_dir))],
            shell=NEED_SUBPROCESS_SHELL
        )
        return result.returncode
    else:
        terminal = pexpect.spawn(
            shell_path or 'xonsh',
            args=['-i', '-D', 'VIRTUAL_ENV={}'.format(os.path.dirname(exe_dir))],
            dimensions=get_terminal_dimensions()
        )

        def sigwinch_passthrough(sig, data):
            terminal.setwinsize(*get_terminal_dimensions())
        signal.signal(signal.SIGWINCH, sigwinch_passthrough)

        # Just in case pyenv works with xonsh, supersede it.
        terminal.sendline('$PATH.insert(0, "{}")'.format(exe_dir))

        terminal.interact(escape_character=None)
        terminal.close()
        return terminal.exitstatus
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号