blob: 5ef3d0f11d7e7a0402e4ba03d1091e9cfbb7fb59 [file] [log] [blame]
Fred Drakea4b5d581999-06-29 18:11:22 +00001\section{\module{pty} ---
2 Pseudo-terminal utilities}
3\declaremodule{standard}{pty}
Fred Drake38e5d272000-04-03 20:13:55 +00004 \platform{IRIX, Linux}
Fred Drakea4b5d581999-06-29 18:11:22 +00005\modulesynopsis{Pseudo-Terminal Handling for SGI and Linux.}
6\moduleauthor{Steen Lumholt}{}
7\sectionauthor{Moshe Zadka}{mzadka@geocities.com}
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}{spawn}{argv\optional{, master_read\optional{, stdin_read}}}
30Spawn a process, and connect its controlling terminal with the current
31process's standard io. This is often used to baffle programs which
32insist on reading from the controlling terminal.
33
34The functions \var{master_read} and \var{stdin_read} should be
35functions which read from a file-descriptor. The defaults try to read
361024 bytes each time they are called.
37\end{funcdesc}