def _open_pty(self):
"""Create a PTY
"""
# get our terminal params
self.tcattr = termios.tcgetattr(STDIN)
winsize = fcntl.ioctl(STDIN, termios.TIOCGWINSZ, '0123')
# open a pty
self.master, self.slave = os.openpty()
# set the slave's terminal params
termios.tcsetattr(self.slave, termios.TCSANOW, self.tcattr)
fcntl.ioctl(self.slave, termios.TIOCSWINSZ, winsize)
评论列表
文章目录