Asciinema: Windows support?

Created on 3 Mar 2016  ·  31Comments  ·  Source: asciinema/asciinema

A Windows console is a (quirky) ANSI terminal, bound up behind the Windows Console API. Assuming a recorder can be made, the existing asciicast file format should be capable of representing nearly anything a Windows Console application can do. The resulting recording should be as playable as any other.

The difficult trick is the recording. Has anyone put any thought or effort into building such a recorder for a Windows console?

Would a port of asciinema to Windows be possible?

feature request packaging

Most helpful comment

For anyone interested in recording on Windows, @mattn has an experimental branch here: https://github.com/mattn/asciinema/tree/windows

All 31 comments

asciinema records raw stdout output of a child process (shell by default). It doesn't "capture" the screen contents in any way. It captures what gets printed (including all escape/control sequences) and it does that using pseudo-terminal (pty).

So far I didn't find any Windows terminal supporting pty but recently I stumbled upon http://babun.github.io . The page says: Mintty is the console used in babun.

Mintty page (https://mintty.github.io) says: Similarly to other Cygwin/MSYS terminals based on pseudo terminal ("pty") devices (...), however there's a long discussion thread about related issue: https://github.com/mintty/mintty/issues/56

If someone finds a way to use pty on Windows (or something faking pty but giving us raw stdout stream) then we could approach asciinema-on-windows.

Are you interesting in native cmd support?

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

But currently experimental.

@mattn whoa! Sure, I'm curious to hear how this was achieved.

For anyone interested in recording on Windows, @mattn has an experimental branch here: https://github.com/mattn/asciinema/tree/windows

Hi! Perhaps this project is useful? https://github.com/adoxa/ansicon

Guys, can I use this tool in git bash for Windows?
I.e. in MinGW. Or in Babun...

I just installed fork from https://github.com/mattn/asciinema/tree/windows but it runs cmd.exe.

@andkirby I heard it worked in bash under Windows but haven't tried myself.

Rumors... :) Thanks.)

@sickill Was this closed because it's merged or because you don't plan to support it?

@masaeedu Thanks for your interest.

I don't plan to support Windows because:

  • most pty-like solutions for Windows are hacks
  • I don't use Windows and as a main asciinema developer I don't want to maintain it

At the moment I believe it's not worth it.

asciinema installs and works perfectly fine under Win10 (WSL): https://asciinema.org/a/123255

Recording Windows terminals really need hacks, AFAIK they still support to write to the console buffer directly with MOV instructions. @miniksa

At the moment I believe it's not worth it.

I guess, it worth it. I really would love to have it the pocket to make some video in Git Bash for Windows.

I just have lots of stuff to show. :)

I'm following with intrest the thread on this Issue. I hope that in the future a solution might come up for supporting use of Asciinema on Window's CMD, PowerShell and Git Bash (without WSL).

In the meantime I'm dropping a few links to resources I've found that might help in that direction:

winpty

winpty is a Windows software package providing an interface similar to a Unix pty-master for communicating with Windows console programs. The package consists of a library (libwinpty) and a tool for Cygwin and MSYS for running Windows console programs in a Cygwin/MSYS pty.

NOTE: winpty is used by the node-pty library below.

node-pty

forkpty(3) bindings for node.js. This allows you to fork processes with pseudoterminal file descriptors. It returns a terminal object which allows reads and writes.

This is useful for:

  • Writing a terminal emulator (eg. via xterm.js).
  • Getting certain programs to think you're a terminal, such as when you need a program to send you control sequences.

node-pty supports Linux, macOS and Windows. Windows support is possible by utilizing the winpty library.

@tajmone thanks for the summary of the possible options. I don't think we'll be able to use node-pty though, as asciinema is written in Python.

I'm not very much familiar with WSL - is this part of Win10, or this needs to be installed separately?

I'm not very much familiar with WSL - is this part of Win10, or this needs to be installed separately?

Me neither ... but from what I read, WSL can be optionally installed in Win 10, and it will then install parts from an actual Ubuntu distro. Since I already have Git Bash for Windows, which offer me all I need right now, I'd rather not install it until I know a bit more about it — WSL surely offers more tools than just Git Bash, and has a broader scope; but I guess it also takes up more space.

@tajmone @andkirby A little late, but you can set different shells with Matt's fork using COMSPEC=cmd, COMSPEC=bash or COMSPEC=powershell. IMHO, COMSPEC would be the right windows variable to set for this sort of function. Example outputs below:

Cmd:
https://asciinema.org/a/r0UNULw8K5r0HV35kTLOatAbX

WSL Bash (launched from within standard terminal):
https://asciinema.org/a/XtLu8rh65uFekim1VbWamNcmh

Powershell:
https://asciinema.org/a/HttJNKCwM9Tb1NlVP5PFy6Ftx

Personally I think it works jolly well...

Thanks a lot @fquinner ! I've read here and there about Matt's fork but didn't realize it had reached such an operative status. The links you provided clarified the situation.

I'll defiinitely look into it!

So asciinema, didn't run on Windows cmd, right?

One other option is to open issue in https://github.com/Microsoft/console to add pty compatible API to cmd. Microsoft Windows Console engineering team such as @bitcrazed is on Github to listen to you.

What @joelhandwell said :) Thanks for suggesting this Joe, and look forward to hearing from y'all on the repo above ;)

giphy

@bitcrazed I went ahead and try to make an issue but already @be5invis submitted https://github.com/Microsoft/console/issues/57 ! People in this issue hopefully give a lot of 👍 to the issue and catch more Microsoft attention.

If you don't want workaround or hacks, go-winpty can be used for this.

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

https://asciinema.org/a/r0UNULw8K5r0HV35kTLOatAbX

https://asciinema.org/a/HttJNKCwM9Tb1NlVP5PFy6Ftx

@fquinner, I'm sorry, could you write in detail, how you record these videos?

I try install and run @mattn fork on Windows, but I don't understand, how I can fix No module named 'termios' error.

Thanks.

Try to build like below:

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)

Thanks.

Sorry, it was my mistake. Please try again as above.

@mattn,

  1. Can you make your version installation more simply? For example, pip install asciinemawindows.
  2. I still can't install your asciinema version (yes, I set 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)

Thanks.

Please move discussion about mattn's fork installation issues to mattn's repo. Thanks! ;)

If you'd like to discuss Windows support in general please use asciinema's discussion forum: https://discourse.asciinema.org/

Was this page helpful?
0 / 5 - 0 ratings