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 |
|
---|
10 | The \module{pty} module defines operations for handling the
|
---|
11 | pseudo-terminal concept: starting another process and being able to
|
---|
12 | write to and read from its controlling terminal programmatically.
|
---|
13 |
|
---|
14 | Because pseudo-terminal handling is highly platform dependant, there
|
---|
15 | is code to do it only for SGI and Linux. (The Linux code is supposed
|
---|
16 | to work on other platforms, but hasn't been tested yet.)
|
---|
17 |
|
---|
18 | The \module{pty} module defines the following functions:
|
---|
19 |
|
---|
20 | \begin{funcdesc}{fork}{}
|
---|
21 | Fork. Connect the child's controlling terminal to a pseudo-terminal.
|
---|
22 | Return value is \code{(\var{pid}, \var{fd})}. Note that the child
|
---|
23 | gets \var{pid} 0, and the \var{fd} is \emph{invalid}. The parent's
|
---|
24 | return value is the \var{pid} of the child, and \var{fd} is a file
|
---|
25 | descriptor connected to the child's controlling terminal (and also
|
---|
26 | to the child's standard input and output).
|
---|
27 | \end{funcdesc}
|
---|
28 |
|
---|
29 | \begin{funcdesc}{openpty}{}
|
---|
30 | Open a new pseudo-terminal pair, using \function{os.openpty()} if
|
---|
31 | possible, or emulation code for SGI and generic \UNIX{} systems.
|
---|
32 | Return a pair of file descriptors \code{(\var{master}, \var{slave})},
|
---|
33 | for the master and the slave end, respectively.
|
---|
34 | \end{funcdesc}
|
---|
35 |
|
---|
36 | \begin{funcdesc}{spawn}{argv\optional{, master_read\optional{, stdin_read}}}
|
---|
37 | Spawn a process, and connect its controlling terminal with the current
|
---|
38 | process's standard io. This is often used to baffle programs which
|
---|
39 | insist on reading from the controlling terminal.
|
---|
40 |
|
---|
41 | The functions \var{master_read} and \var{stdin_read} should be
|
---|
42 | functions which read from a file-descriptor. The defaults try to read
|
---|
43 | 1024 bytes each time they are called.
|
---|
44 | \end{funcdesc}
|
---|