I'm attempting to put together a presentation on Pulumi for the second NE-RPC conference - so am I writing my script or the code to go with? No, I'm wondering if I can use [asciinema] to record working at the command line to embed in the presentation... in fairness to me this is a sensible thing to want to do given that I'm trying to do a pre-recorded session.
So what's the problem
The basic problem is that "windows" isn't supported because the existing windows console sucks... except that we don't just have the existing windows console any more, now we have Windows Terminal, one that explicitly plays nicer with the "standards" for terminals and so things get a bit more interesting.
At this point there's good news and bad... the good is that asciinema is python - so in theory runnable, the less good is that there is no python on this box.
I've got two options at this point, one is to try running in WSL and the other... well in theory it should "just work" in a terminal window.
Chocolatey is my friend (I could probably do this via a Visual Studio workload too):
choco install python -y
Which is almost perfect (I now have python but I also need pip)
Long story short... didn't work - asciinema has a python dependency that's not supported on Windows
If at first...
In this case the answer is to go slightly sideways. My fallback position is to run asciinema under (WSL 2)[https://docs.microsoft.com/en-us/windows/wsl/about] but you can (now) launch a windows app from a linux command line and have it work - so what if we could run asciinema in linux to record powershell running in windows
This turns out to straightforward, the hardest part (!) was working out where the powershell executable lives.
I already had Ubuntu installed for WSL, so I made sure python was up to date, and that pip3 was installed and up to date.
Then I did
sudo pip3 install asciinema - per the installation intructions. That worked pretty much as expected and so I was good to go.
On my machine Powershell Core 7 is installed into
C:\Program Files\PowerShell\7 and the executable is
So I opened up windows terminal, opened a tab to run ubunutu and typed the following:
asciinema rec /mnt/c/'Program Files'/PowerShell/7/pwsh.exe get-location get-childitem exit exit
That does the following:
- Starts recording
- Opens a windows powershell session in the same terminal window from the linux shell
- Gets the current location in powershell
- Lists the files in that location
- exits from powershell
- exits from the recording
The result can be seen here: [https://asciinema.org/a/356995]
Hmm, one can do better:
asciinema rec --command="/mnt/c/'Program Files'/PowerShell/7/pwsh.exe"
Now it launches straight into windows powershell. Neat.