prompt-toolkit / ptterm

Terminal emulator widget for prompt_toolkit applications.
BSD 3-Clause "New" or "Revised" License
41 stars 11 forks source link

write to Terminal #6

Open ppacory opened 3 years ago

ppacory commented 3 years ago

is there a way to write to terminal window layout from python to send command to bash ? something like this: term1 = Terminal(....) term1.write("the command")

ppacory commented 3 years ago

perhaps : ....

import sys
with open("/dev/pts/1", "wb+", buffering=0) as term: term.write("hello".encode())

under linux : echo 'ls -l' > /dev/pts/1 ...

don't seem to be very clean solution ...