Asciinema: 视窗支持?

创建于 2016-03-03  ·  31评论  ·  资料来源: asciinema/asciinema

Windows 控制台是一个(古怪的)ANSI 终端,绑定在 Windows 控制台 API 后面。 假设可以制作一个记录器,现有的 asciicast 文件格式应该能够表示几乎任何 Windows 控制台应用程序可以执行的操作。 生成的录音应该和其他录音一样可播放。

困难的技巧是录音。 有没有人为 Windows 控制台构建这样的记录器付出了任何想法或努力?

将 asciinema 移植到 Windows 是可能的吗?

feature request packaging

最有用的评论

对于任何有兴趣在 Windows 上录制的人, @mattn在这里有一个实验分支: https ://github.com/mattn/asciinema/tree/windows

所有31条评论

asciinema 记录子进程的原始 stdout 输出(默认为 shell)。 它不会以任何方式“捕获”屏幕内容。 它捕获打印的内容(包括所有转义/控制序列),并使用伪终端(pty)来实现。

到目前为止,我还没有找到任何支持 pty 的 Windows 终端,但最近我偶然发现了http://babun.github.io 。 该页面显示: Mintty is the console used in babun.

Mintty 页面 (https://mintty.github.io) 说: Similarly to other Cygwin/MSYS terminals based on pseudo terminal ("pty") devices (...) ,但是关于相关问题的讨论很长: https://github.com/mintty/mintty/issues/56

如果有人找到了在 Windows 上使用 pty 的方法(或者一些伪造 pty 但给我们原始标准输出流的方法),那么我们可以使用 asciinema-on-windows。

您对本机 cmd 支持感兴趣吗?

https://asciinema.org/a/0nsiofsbhypumh6vy5jx6wuog

但目前是实验性的。

@mattn哇! 当然,我很想知道这是如何实现的。

对于任何有兴趣在 Windows 上录制的人, @mattn在这里有一个实验分支: https ://github.com/mattn/asciinema/tree/windows

你好! 也许这个项目有用? https://github.com/adoxa/ansicon

伙计们,我可以在 Windows 的 git bash 中使用这个工具吗?
即在MinGW中。 或者在巴本...

我刚刚从https://github.com/mattn/asciinema/tree/windows安装了 fork,但它运行cmd.exe

@andkirby我听说它在 Windows 下的 bash 中工作,但我自己没有尝试过。

谣言... :) 谢谢。)

@sickill这是因为它被合并还是因为你不打算支持它而关闭?

@masaeedu感谢您的关注。

我不打算支持 Windows,因为:

  • 大多数类似 pty 的 Windows 解决方案都是 hack
  • 我不使用 Windows,作为主要的 asciinema 开发人员,我不想维护它

目前我认为这不值得。

asciinema 在 Win10 (WSL) 下安装并运行良好: https ://asciinema.org/a/123255

录制 Windows 终端确实需要 hack,AFAIK 他们仍然支持使用 MOV 指令直接写入控制台缓冲区。 @miniksa

目前我认为这不值得。

我想,这是值得的。 我真的很想有它的口袋在 Windows 的 Git Bash 中制作一些视频。

我只是有很多东西要展示。 :)

我正在关注这个问题的主题。 我希望将来可能会出现一个解决方案来支持在 Window 的 CMD、PowerShell 和 Git Bash(没有 WSL)上使用 Asciinema。

与此同时,我删除了一些指向我发现的资源的链接,这些链接可能有助于朝这个方向发展:

温pty

winpty 是一个 Windows 软件包,提供类似于 Unix pty-master 的接口,用于与 Windows 控制台程序进行通信。 该软件包由一个库 (libwinpty) 和一个用于 Cygwin 和 MSYS 的工具组成,用于在 Cygwin/MSYS pty 中运行 Windows 控制台程序。

注意:下面的 node-pty 库使用了 winpty。

节点pty

node.js 的forkpty(3)绑定。 这允许您使用伪终端文件描述符来分叉进程。 它返回一个允许读写的终端对象。

这对于:

  • 编写终端仿真器(例如,通过 xterm.js)。
  • 让某些程序认为您是终端,例如当您需要程序向您发送控制序列时。

node-pty 支持 Linux、macOS 和 Windows。 通过使用winpty库可以支持 Windows。

@tajmone感谢您对可能选项的总结。 我不认为我们将能够使用 node-pty,因为 asciinema 是用 Python 编写的。

我对WSL不是很熟悉-这是Win10的一部分,还是需要单独安装?

我对WSL不是很熟悉-这是Win10的一部分,还是需要单独安装?

我也没有……但是根据我的阅读,WSL 可以选择安装在 Win 10 中,然后它将安装来自实际 Ubuntu 发行版的部件。 由于我已经拥有适用于 Windows 的 Git Bash,它提供了我现在所需的一切,我宁愿在对它了解更多之前不安装它——WSL 肯定提供了比 Git Bash 更多的工具,并且范围更广; 但我想它也会占用更多空间。

@tajmone @andkirby有点晚了,但是您可以使用 Matt 的叉子设置不同的外壳,使用COMSPEC=cmdCOMSPEC=bashCOMSPEC=powershell 。 恕我直言,COMSPEC 将是为此类功能设置的正确windows 变量。 下面的示例输出:

命令:
https://asciinema.org/a/r0UNULw8K5r0HV35kTLOatAbX

WSL Bash(从标准终端内启动):
https://asciinema.org/a/XtLu8rh65uFekim1VbWamNcmh

电源外壳:
https://asciinema.org/a/HttJNKCwM9Tb1NlVP5PFy6Ftx

个人觉得效果不错。。。

非常感谢@fquinner ! 我在这里和那里读到过关于马特的叉子,但没有意识到它已经达到了如此可操作的状态。 您提供的链接澄清了这种情况。

我一定会调查的!

所以 asciinema,没有在 Windows cmd 上运行,对吧?

另一种选择是在https://github.com/Microsoft/console中打开问题以将 pty 兼容 API 添加到 cmd。 @bitcrazed等 Microsoft Windows 控制台工程团队在 Github 上听取您的意见。

@joelhandwell说了什么 :) 感谢您向 Joe 提出建议,并期待在上面的 repo 上收到大家的来信;)

giphy

@bitcrazed我继续尝试提出问题,但@be5invis已经提交了https://github.com/Microsoft/console/issues/57 ! 希望在这个问题上的人们对这个问题给予很多👍并引起更多微软的关注。

如果您不想要解决方法或黑客,可以使用 go-winpty。

https://github.com/iamacarpet/go-winpty

https://asciinema.org/a/r0UNULw8K5r0HV35kTLOatAbX

https://asciinema.org/a/HttJNKCwM9Tb1NlVP5PFy6Ftx

@fquinner ,对不起,你能详细写一下,你是如何录制这些视频的吗?

我尝试在 Windows 上安装并运行@mattn fork,但我不明白如何修复No module named 'termios'错误

谢谢。

尝试构建如下:

mkdir \path\to\your\gopath\src\github.com\mattn
cd \path\to\your\gopath\src\github.com\mattn
git clone https://github.com/mattn/asciinema
cd asciinema
git checkout windows
go build

@mattn

D:\>go version
go version go1.10 windows/amd64

D:\>go get -d github.com/mattn/asciinema
package github.com/asciinema/asciinema/Godeps/_workspace/src/github.com/docopt/docopt-go: cannot find package "github.com/asciinema/asciinema/Godeps/_workspace/src/github.com/docopt/docopt-go" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\Godeps\_workspace\src\github.com\docopt\docopt-go (from $GOROOT)
        C:\Users\SashaChernykh\go\src\github.com\asciinema\asciinema\Godeps\_workspace\src\github.com\docopt\docopt-go (from $GOPATH)
package github.com/asciinema/asciinema/api: cannot find package "github.com/asciinema/asciinema/api" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\api (from $GOROOT)
        C:\Users\SashaChernykh\go\src\github.com\asciinema\asciinema\api (from $GOPATH)
package github.com/asciinema/asciinema/commands: cannot find package "github.com/asciinema/asciinema/commands" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\commands (from $GOROOT)
        C:\Users\SashaChernykh\go\src\github.com\asciinema\asciinema\commands (from $GOPATH)
package github.com/asciinema/asciinema/util: cannot find package "github.com/asciinema/asciinema/util" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\util (from $GOROOT)
        C:\Users\SashaChernykh\go\src\github.com\asciinema\asciinema\util (from $GOPATH)

谢谢。

对不起,是我的错。 请按上述方法重试。

@mattn

  1. 能让你的版本安装更简单吗? 例如, pip install asciinemawindows
  2. 我仍然无法安装您的 asciinema 版本(是的,我设置了 gopath ):
D:\go\src\github.com\mattn\asciinema>go build
main.go:11:2: cannot find package "github.com/asciinema/asciinema/Godeps/_workspace/src/github.com/docopt/docopt-go" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\Godeps\_workspace\src\github.com\docopt\docopt-go (from $GOROOT)
        D:\go\src\github.com\asciinema\asciinema\Godeps\_workspace\src\github.com\docopt\docopt-go (from $GOPATH)
main.go:12:2: cannot find package "github.com/asciinema/asciinema/api" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\api (from $GOROOT)
        D:\go\src\github.com\asciinema\asciinema\api (from $GOPATH)
main.go:13:2: cannot find package "github.com/asciinema/asciinema/commands" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\commands (from $GOROOT)
        D:\go\src\github.com\asciinema\asciinema\commands (from $GOPATH)
main.go:14:2: cannot find package "github.com/asciinema/asciinema/util" in any of:
        C:\tools\go\src\github.com\asciinema\asciinema\util (from $GOROOT)
        D:\go\src\github.com\asciinema\asciinema\util (from $GOPATH)
main.go:15:2: cannot find package "github.com/mattn/go-colorable" in any of:
        C:\tools\go\src\github.com\mattn\go-colorable (from $GOROOT)
        D:\go\src\github.com\mattn\go-colorable (from $GOPATH)

谢谢。

请将有关 mattn 的 fork 安装问题的讨论移至 mattn 的 repo。 谢谢! ;)

如果您想讨论 Windows 支持,请使用 asciinema 的论坛: https ://discourse.asciinema.org/

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

nictuku picture nictuku  ·  10评论

SR-Lut3t1um picture SR-Lut3t1um  ·  3评论

dlintw picture dlintw  ·  11评论

bashfulrobot picture bashfulrobot  ·  11评论

abaykan picture abaykan  ·  10评论