Jian Wen added the comment:
The following code shows how to use pts.
#!/usr/bin/env python
import os
import pty
import shlex
import time
_args = "/usr/bin/ssh example.com"
args = shlex.split(_args)
pid, child_fd = pty.fork()
if pid == 0:
# Child
os.execv("/usr/bin/ssh", args)
else:
# Parent
while True:
os.write(child_fd, '# keep alive\n')
os.read(child_fd, 1024)
time.sleep(2)
----------
nosy: +Jian.Wen
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14000>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com