termrec
termrec copied to clipboard
2nd run exits immediately
When I run termrec second time, new shell exits immediately and it is impossible to record any commands:
$ SHELL='/bin/sh' ./termrec rec test.log
CWD: /home/macie/termrec
$ echo 123
123
$ ^D
Session Recorded Successfully!
$ cat test.log
{
"duration": 5.55092907,
"version": 1,
"timestamp": 1687726492,
"width": 80,
"height": 30,
"command": "",
"title": "",
"env": {"SHELL":"/bin/sh","TERM":"xterm-256color","PS1":"$(__update_ps1)","PS2":" > "},
"stdout": [
[ 0, "" ],
[ 0.0000, "$ " ],
[ 2.0180, "e" ],
[ 0.1563, "c" ],
[ 0.1489, "h" ],
[ 0.1277, "o" ],
[ 0.1662, " " ],
[ 0.3606, "1" ],
[ 0.1419, "2" ],
[ 0.2694, "3" ],
[ 0.4154, "\u000d\u000d\u000a" ],
[ 0.0002, "123\u000d\u000a" ],
[ 0.0396, "$ " ],
[ 1.7066, "^D\u000d\u000d\u000a" ]
]
}
$ SHELL='/bin/sh' ./termrec rec test.log
CWD: /home/macie/termrec
Session Recorded Successfully!
$ cat test.log
{
"duration": 0,
"version": 1,
"timestamp": 1687726530,
"width": 80,
"height": 30,
"command": "",
"title": "",
"env": {"SHELL":"/bin/sh","TERM":"xterm-256color","PS1":"$(__update_ps1)","PS2":" > "},
"stdout": [
[ 0, "" ]
]
}
If the program can read commands to be recorded, then it will be easy to automate regression testing during CI job (and local development). Example of simple end-user test where commands are read from stdin, line-by-line:
$ ./termrec rec test_rec.cast <<EOF
echo "test_string"
exit
EOF
$ grep -q "test_string" test_rec.cast
i don't want to complicate this program to add those features, and i don't think it's a really good idea to allow a "recording" software to execute commands, security wise.
i still don't know what is causing the issue that the program is failing to record second time, i am looking into it.
I share your point of view on features. But this kind of automatic test could help figuring out source of problems - if test passes on all CI, but not on user device, then there is probably something with user-specific configuration.
I've found that all known (to me) terminal recorders allows to specify command to be executed inside recorded session:
script -c 'echo "test_string"' test_rec.cast(source)ttyrec -e 'echo "test_string"' test_rec.cast(source)asciinema rec -e 'echo "test_string"' test_rec.cast(source) Commands are specified by flag, because input from stdin can never end (for exampleyes | grep "n").
From my understanding of security there is no difference between writing recorder -c command and recorder then command.
Hi There, It's been almost a year? I've learnt more about C & Makefiles, and I will implement this feature.