Replies: 2 comments 2 replies
-
Nice! This is some serious unix hacking 👏 Would it make it simpler if asciinema had some sort of RPC mechanism to toggle pause? E.g. by invoking something like |
Beta Was this translation helpful? Give feedback.
-
Another alternative to the control socket above could be control via signals. asciinema could set |
Beta Was this translation helpful? Give feedback.
-
I'm currently using asciinema to record all of my terminal sessions. However, I would like to be able to programmatically stop or pause a recording; for example, when ssh-ing to another system (so that only my local activity gets recorded). Killing the parent asciinema process is either ignored (if I use HUP/TERM/etc) or causes the shell itself to be recorded (if I use SIGKILL).
For pausing I have figured out a somewhat horrifying workaround. Assuming you have permissions (it requires root on macOS), you can send characters directly to another terminal's stdin by using the
TIOCSTI
ioctl on the terminal device (e.g.,/dev/ttys002
). The programwritevt
(source available here; just usegcc writevt.c -o writevt
to compile) can be used to do this from the command line.So here's a function I added to my bash startup script. Now inside a recording I can call
asciinema_toggle_pause
and it will pause the recording for me. Handling more deeply nested subshells isleft as an exercise for the readeralso handled.I also added writevt to
sudoers
for my user so that it doesn't need a password. This is horribly insecure on a multiuser system, since it means I'd have the ability to inject commands into anyone else's terminal sessions. But this is just my laptop so it's fine:/private/etc/sudoers.d/001-writevt
:Beta Was this translation helpful? Give feedback.
All reactions