source: vendor/python/2.5/Doc/lib/libpty.tex

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 1.8 KB
Line 
1\section{\module{pty} ---
2 Pseudo-terminal utilities}
3\declaremodule{standard}{pty}
4 \platform{IRIX, Linux}
5\modulesynopsis{Pseudo-Terminal Handling for SGI and Linux.}
6\moduleauthor{Steen Lumholt}{}
7\sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il}
8
9
10The \module{pty} module defines operations for handling the
11pseudo-terminal concept: starting another process and being able to
12write to and read from its controlling terminal programmatically.
13
14Because pseudo-terminal handling is highly platform dependant, there
15is code to do it only for SGI and Linux. (The Linux code is supposed
16to work on other platforms, but hasn't been tested yet.)
17
18The \module{pty} module defines the following functions:
19
20\begin{funcdesc}{fork}{}
21Fork. Connect the child's controlling terminal to a pseudo-terminal.
22Return value is \code{(\var{pid}, \var{fd})}. Note that the child
23gets \var{pid} 0, and the \var{fd} is \emph{invalid}. The parent's
24return value is the \var{pid} of the child, and \var{fd} is a file
25descriptor connected to the child's controlling terminal (and also
26to the child's standard input and output).
27\end{funcdesc}
28
29\begin{funcdesc}{openpty}{}
30Open a new pseudo-terminal pair, using \function{os.openpty()} if
31possible, or emulation code for SGI and generic \UNIX{} systems.
32Return a pair of file descriptors \code{(\var{master}, \var{slave})},
33for the master and the slave end, respectively.
34\end{funcdesc}
35
36\begin{funcdesc}{spawn}{argv\optional{, master_read\optional{, stdin_read}}}
37Spawn a process, and connect its controlling terminal with the current
38process's standard io. This is often used to baffle programs which
39insist on reading from the controlling terminal.
40
41The functions \var{master_read} and \var{stdin_read} should be
42functions which read from a file-descriptor. The defaults try to read
431024 bytes each time they are called.
44\end{funcdesc}
Note: See TracBrowser for help on using the repository browser.