Mimicking a shell

Adam D. Ruppe destructionator at gmail.com
Sat Jan 4 18:52:26 UTC 2020


On Saturday, 4 January 2020 at 18:43:13 UTC, Jan wrote:
> I am using Linux (Fedora).

ok, the starting point is `openpty` which gives you a 
communication pipe that the other program sees as a terminal. 
from there if you are just forwarding you can perhaps shoot bytes 
to and from without interpreting them.

but if you want to send like a synthetic arrow keystroke, well, 
things get ugly again, it will need to send the right series of 
bytes based on what terminal the program thinks you are.

Like "\033[C" is right arrow on xterm, probably a reasonably safe 
bet you can make that work. hit ctrl+v then a key in your 
terminal to see the output. ^[ == "\033" btw there.

> Thanks, @angel. I'll take a look at your suggestion :)

yes good luck!


More information about the Digitalmars-d-learn mailing list