Module pty
[hide private]
[frames] | no frames]

Module pty

Pseudo terminal utilities.

Functions [hide private]
(master_fd, slave_fd)
openpty()
Open a pty master/slave pair, using os.openpty() if possible.
(master_fd, slave_name)
master_open()
Open a pty master and return the fd, and the filename of the slave end.
 
_open_terminal()
Open pty master and return (master_fd, tty_name).
slave_fd
slave_open(tty_name)
Open the pty slave and acquire the controlling terminal, returning opened filedescriptor.
(pid, master_fd)
fork()
Fork and make the child a session leader with a controlling terminal.
 
_writen(fd, data)
Write all the data to a descriptor.
 
_read(fd)
Default read function.
 
_copy(master_fd, master_read=<function _read at 0x412ad79c>, stdin_read=<function _read at 0x412ad79c>)
Parent copy loop.
 
spawn(argv, master_read=<function _read at 0x412ad79c>, stdin_read=<function _read at 0x412ad79c>)
Create a spawned process.
Variables [hide private]
  STDIN_FILENO = 0
  STDOUT_FILENO = 1
  STDERR_FILENO = 2
  CHILD = 0

Imports: select, os, tty


Function Details [hide private]

master_open()

 

Open a pty master and return the fd, and the filename of the slave end. Deprecated, use openpty() instead.

Returns: (master_fd, slave_name)

_open_terminal()

 

Open pty master and return (master_fd, tty_name). SGI and generic BSD version, for when openpty() fails.

slave_open(tty_name)

 

Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.

Returns: slave_fd

_copy(master_fd, master_read=<function _read at 0x412ad79c>, stdin_read=<function _read at 0x412ad79c>)

 
Parent copy loop.
Copies
        pty master -> standard output   (master_read)
        standard input -> pty master    (stdin_read)