I've tried to use the subprocess, popen, os.spawn to get a process running, but it seems as though a pseudo terminal is needed.
import pty
(master, slave) = pty.openpty()
os.write(master, "ls -l")
Should send "ls -l" to the slave tty... I tried to read the response os.read(master, 1024), but nothing was available.
EDIT:
Also tried to create pty's, then open the call in a subprocess -- still didn't work.
import pty
import subprocess
(master, slave) = os.openpty()
p = subprocess.Popen("ls", close_fds=True, shell=slave, stdin=slave, stdout=slave)
Similar:
Send command and exit using python pty pseudo terminal process
How do *nix pseudo-terminals work ? What's the master/slave channel?
ls
. A pipe will work with that just fine. What did you try there? – Keithls
to test the functionality. – user791953ls
in apty
then? – user791953