This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wenjianhn
Recipients amoffat, rosslagerwall, wenjianhn
Date 2013-06-18.07:39:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371541188.41.0.983990409142.issue14000@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2013-06-18 07:39:48wenjianhnsetrecipients: + wenjianhn, rosslagerwall, amoffat
2013-06-18 07:39:48wenjianhnsetmessageid: <1371541188.41.0.983990409142.issue14000@psf.upfronthosting.co.za>
2013-06-18 07:39:48wenjianhnlinkissue14000 messages
2013-06-18 07:39:48wenjianhncreate