[issue14000] Subprocess stdin.flush does not flush

Jian Wen report at bugs.python.org
Tue Jun 18 09:39:48 CEST 2013


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 <report at bugs.python.org>
<http://bugs.python.org/issue14000>
_______________________________________


More information about the Python-bugs-list mailing list