• 请不要在回答技术问题时复制粘贴 AI 生成的内容
ithelloworld
V2EX  ›  程序员

如何以Web的形式实时显示terminal中的内容?

  •  
  •   ithelloworld · Mar 7, 2013 · 5813 views
    This topic created in 4999 days ago, the information mentioned may be changed or developed.
    执行一段脚本,可以在terminal中看打印输出结果。
    如果想在网页,浏览器中检视此事,能不能办到?
    就像Ubuntu软件安装一样,安装界面点击“详细”可看到执行的详细安装信息。
    11 replies  •  1970-01-01 08:00:00 +08:00
    ratazzi
    ratazzi
    PRO
    Mar 7, 2013❤️1
    1
    python 的话用 subprocess.Popen 调用脚本,再通过 websocket 一类的将标准输出输出到浏览器
    luztak
    luztak
    Mar 7, 2013 via Android
    2
    运行一个shell,把socket的io设置成stdin/stdout.
    这个在Windows上能用,Linux没测试.
    从某本书上看的.
    ithelloworld
    ithelloworld
    OP
    Mar 7, 2013
    4
    @amoblin 这个支持的命令好像不多呀
    amoblin
    amoblin
    Mar 7, 2013
    5
    @ithelloworld 大致看了下,没细研究。如果不要求实时的话,可以用一下Marboo Shell: http://marboo.biz/guide/#marboo-shell
    ericFork
    ericFork
    Mar 7, 2013
    6
    @ratazzi +1, 我们就是这么做的
    zodiac1111
    zodiac1111
    Mar 7, 2013
    7
    我知道有用shellinabox的(比如落云).看看是不是你的需要.
    wangkangluo1
    wangkangluo1
    Mar 8, 2013
    9
    wangkangluo1
    wangkangluo1
    Mar 8, 2013
    10
    @wangkangluo1 长期使用shellinbox,其他有
    Ajaxterm
    Anyterm
    Commando.io
    Gate One
    WebShell
    tty.js
    但推荐shellinbox.
    BOYPT
    BOYPT
    Mar 8, 2013
    11
    如果要只看不输入的话也没什么困难的,Popen stdout喂queue,web线程消费queue,ajax定时刷新这个接口,append到DOM就是了。

    为了避免内存泄漏什么的,当然最好用环队列。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2091 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 11:43 · PVG 19:43 · LAX 03:43 · JFK 06:43
    ♥ Do have faith in what you're doing.