diff options
| author | Thien-Thi Nguyen | 2012-06-24 17:30:35 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-06-24 17:30:35 +0800 |
| commit | 6d41a41d81d60e8a351e85656ba71c99ab8f6bf5 (patch) | |
| tree | ad023685d8f5977a5b928d3a6221cb2f195ad820 | |
| parent | f1dd807386718d2c7c29d13b9f7615759086a954 (diff) | |
| download | emacs-6d41a41d81d60e8a351e85656ba71c99ab8f6bf5.tar.gz emacs-6d41a41d81d60e8a351e85656ba71c99ab8f6bf5.zip | |
Lisp manual -- improve discussion of ptys vs pipes.
* processes.texi (Asynchronous Processes): Make the pty vs pipe
discussion more prominent.
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/processes.texi | 39 |
2 files changed, 26 insertions, 18 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 154b4487d5e..782b6930a84 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-06-24 Thien-Thi Nguyen <ttn@gnuvola.org> | ||
| 2 | |||
| 3 | * processes.texi (Asynchronous Processes): Make the pty vs pipe | ||
| 4 | discussion more prominent. | ||
| 5 | |||
| 1 | 2012-06-23 Eli Zaretskii <eliz@gnu.org> | 6 | 2012-06-23 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * commands.texi (Misc Events): Document the language-change event. | 8 | * commands.texi (Misc Events): Document the language-change event. |
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index d1bfa0e936d..fc166268e4e 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -541,16 +541,29 @@ is decoded in the same way as for @code{call-process}. | |||
| 541 | @section Creating an Asynchronous Process | 541 | @section Creating an Asynchronous Process |
| 542 | @cindex asynchronous subprocess | 542 | @cindex asynchronous subprocess |
| 543 | 543 | ||
| 544 | After an @dfn{asynchronous process} is created, Emacs and the subprocess | 544 | In this section, we describe how to create an @dfn{asynchronous |
| 545 | both continue running immediately. The process thereafter runs | 545 | process}. After an asynchronous process is created, it runs in |
| 546 | in parallel with Emacs, and the two can communicate with each other | 546 | parallel with Emacs, and Emacs can communicate with it using the |
| 547 | using the functions described in the following sections. However, | 547 | functions described in the following sections (@pxref{Input to |
| 548 | Processes}, and @pxref{Output from Processes}). Note that process | ||
| 548 | communication is only partially asynchronous: Emacs sends data to the | 549 | communication is only partially asynchronous: Emacs sends data to the |
| 549 | process only when certain functions are called, and Emacs accepts data | 550 | process only when certain functions are called, and Emacs accepts data |
| 550 | from the process only when Emacs is waiting for input or for a time | 551 | from the process only while waiting for input or for a time delay. |
| 551 | delay. | 552 | |
| 552 | 553 | @cindex pty | |
| 553 | Here we describe how to create an asynchronous process. | 554 | @cindex pipe |
| 555 | An asynchronous process is controlled either via a @dfn{pty} | ||
| 556 | (pseudo-terminal) or a @dfn{pipe}. The choice of pty or pipe is made | ||
| 557 | when creating the process, based on the value of the variable | ||
| 558 | @code{process-connection-type} (see below). Ptys are usually | ||
| 559 | preferable for processes visible to the user, as in Shell mode, | ||
| 560 | because they allow for job control (@kbd{C-c}, @kbd{C-z}, etc.) | ||
| 561 | between the process and its children, whereas pipes do not. For | ||
| 562 | subprocesses used for internal purposes by programs, it is often | ||
| 563 | better to use a pipe, because they are more efficient, and because | ||
| 564 | they are immune to stray character injections that ptys introduce for | ||
| 565 | large (around 500 byte) messages. Also, the total number of ptys is | ||
| 566 | limited on many systems and it is good not to waste them. | ||
| 554 | 567 | ||
| 555 | @defun start-process name buffer-or-name program &rest args | 568 | @defun start-process name buffer-or-name program &rest args |
| 556 | This function creates a new asynchronous subprocess and starts the | 569 | This function creates a new asynchronous subprocess and starts the |
| @@ -652,20 +665,10 @@ can also be executed on remote hosts, depending on @code{default-directory}. | |||
| 652 | @end defun | 665 | @end defun |
| 653 | 666 | ||
| 654 | @defvar process-connection-type | 667 | @defvar process-connection-type |
| 655 | @cindex pipes | ||
| 656 | @cindex @acronym{PTY}s | ||
| 657 | This variable controls the type of device used to communicate with | 668 | This variable controls the type of device used to communicate with |
| 658 | asynchronous subprocesses. If it is non-@code{nil}, then @acronym{PTY}s are | 669 | asynchronous subprocesses. If it is non-@code{nil}, then @acronym{PTY}s are |
| 659 | used, when available. Otherwise, pipes are used. | 670 | used, when available. Otherwise, pipes are used. |
| 660 | 671 | ||
| 661 | @acronym{PTY}s are usually preferable for processes visible to the user, as | ||
| 662 | in Shell mode, because they allow job control (@kbd{C-c}, @kbd{C-z}, | ||
| 663 | etc.) to work between the process and its children, whereas pipes do | ||
| 664 | not. For subprocesses used for internal purposes by programs, it is | ||
| 665 | often better to use a pipe, because they are more efficient. In | ||
| 666 | addition, the total number of @acronym{PTY}s is limited on many systems and | ||
| 667 | it is good not to waste them. | ||
| 668 | |||
| 669 | The value of @code{process-connection-type} takes effect when | 672 | The value of @code{process-connection-type} takes effect when |
| 670 | @code{start-process} is called. So you can specify how to communicate | 673 | @code{start-process} is called. So you can specify how to communicate |
| 671 | with one subprocess by binding the variable around the call to | 674 | with one subprocess by binding the variable around the call to |