💾 Archived View for tris.fyi › pydoc › pty captured on 2023-04-26 at 13:31:27. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Back to module index

Go to module by name

pty

Pseudo terminal utilities.

Functions

close

close(fd)

  Close a file descriptor.

fork

fork()

  fork() -> (pid, master_fd)
      Fork and make the child a session leader with a controlling terminal.

master_open

master_open()

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

openpty

openpty()

  openpty() -> (master_fd, slave_fd)
      Open a pty master/slave pair, using os.openpty() if possible.

select

select(rlist, wlist, xlist, timeout=None, /)

  Wait until one or more file descriptors are ready for some kind of I/O.

  The first three arguments are iterables of file descriptors to be waited for:
  rlist -- wait until ready for reading
  wlist -- wait until ready for writing
  xlist -- wait for an "exceptional condition"
  If only one kind of condition is required, pass [] for the other lists.

  A file descriptor is either a socket or file object, or a small integer
  gotten from a fileno() method call on one of those.

  The optional 4th argument specifies a timeout in seconds; it may be
  a floating point number to specify fractions of seconds.  If it is absent
  or None, the call will never time out.

  The return value is a tuple of three lists corresponding to the first three
  arguments; each contains the subset of the corresponding file descriptors
  that are ready.

  *** IMPORTANT NOTICE ***
  On Windows, only sockets are supported; on Unix, all file
  descriptors can be used.

setraw

setraw(fd, when=2)

  Put terminal into a raw mode.

slave_open

slave_open(tty_name)

  slave_open(tty_name) -> slave_fd
      Open the pty slave and acquire the controlling terminal, returning
      opened filedescriptor.
      Deprecated, use openpty() instead.

spawn

spawn(argv, master_read=<function _read at 0x7f75e0ba97e0>, stdin_read=<function _read at 0x7f75e0ba97e0>)

  Create a spawned process.

tcgetattr

tcgetattr(fd, /)

  Get the tty attributes for file descriptor fd.

  Returns a list [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]
  where cc is a list of the tty special characters (each a string of
  length 1, except the items with indices VMIN and VTIME, which are
  integers when these fields are defined).  The interpretation of the
  flags and the speeds as well as the indexing in the cc array must be
  done using the symbolic constants defined in this module.

tcsetattr

tcsetattr(fd, when, attributes, /)

  Set the tty attributes for file descriptor fd.

  The attributes to be set are taken from the attributes argument, which
  is a list like the one returned by tcgetattr(). The when argument
  determines when the attributes are changed: termios.TCSANOW to
  change immediately, termios.TCSADRAIN to change after transmitting all
  queued output, or termios.TCSAFLUSH to change after transmitting all
  queued output and discarding all queued input.

waitpid

waitpid(pid, options, /)

  Wait for completion of a given child process.

  Returns a tuple of information regarding the child process:
      (pid, status)

  The options argument is ignored on Windows.

Other members

CHILD = 0
STDERR_FILENO = 2
STDIN_FILENO = 0
STDOUT_FILENO = 1

Modules

os

sys

tty