trex_console.py 文件源码

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

项目:trex-http-proxy 作者: alwye 项目源码 文件源码
def do_tui (self, line):
        '''Shows a graphical console\n'''

        parser = parsing_opts.gen_parser(self,
                                         "tui",
                                         self.do_tui.__doc__,
                                         parsing_opts.XTERM)

        opts = parser.parse_args(line.split())
        if opts is None:
            return

        if opts.xterm:
            if not os.path.exists('/usr/bin/xterm'):
                print(format_text("XTERM does not exists on this machine", 'bold'))
                return

            info = self.stateless_client.get_connection_info()

            exe = './trex-console --top -t -q -s {0} -p {1} --async_port {2}'.format(info['server'], info['sync_port'], info['async_port'])
            cmd = ['/usr/bin/xterm', '-geometry', '111x49', '-sl', '0', '-title', 'trex_tui', '-e', exe]

            # detach child
            self.terminal = subprocess.Popen(cmd, preexec_fn = os.setpgrp)

            return


        with self.stateless_client.logger.supress():
            self.tui.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号