Miniexpect – A very simple expect-like library
github.com
github.com
So for everyone as ignorant as myself, I guess it's referring to this[1]:
> Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc.
Here is it in 1997, it hasn't changed much.
https://web.archive.org/web/19971210131642/http://expect.nis...
https://github.com/rwmjones/miniexpect/blob/master/example-s...
I think the library is quite elegant because it essentially does very little itself. It's implemented almost entirely using the "partial match" feature of PCRE: https://pcre.org/current/doc/html/pcre2partial.html This means it can use the super-powerful regexps in PCRE, while itself being only a few hundred lines of code.
This library has been used for years (since 2014) to do physical to virtual machine conversions, specifically for connecting from the physical machine to the remote hypervisor and automating virt-v2v: https://github.com/libguestfs/virt-p2v/blob/master/virt-p2v.... https://github.com/libguestfs/virt-p2v/blob/master/ssh.c
There are also expect clones in Python and Perl (probably others, but I know and have used those both) if TCL is an issue for you.
This looks nice, but I don't see if as very useful.
Create isatty.so like this:
echo "int isatty(int fd) { return 1; }" | gcc -O2 -fpic -shared -ldl -o isatty.so -xc -
Then to make `some_program` think it's in a tty: LD_PRELOAD=./isatty.so some_programe
Source and more: https://unix.stackexchange.com/questions/249723/how-to-trick...