[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
There are two ways to receive the output that a subprocess writes to its standard output stream. The output can be inserted in a buffer, which is called the associated buffer of the process, or a function called the filter function can be called to act on the output. If the process has no buffer and no filter function, its output is discarded.
When a subprocess terminates, Emacs reads any pending output, then stops reading output from that subprocess. Therefore, if the subprocess has children that are still live and still producing output, Emacs won't receive that output.
Output from a subprocess can arrive only while Emacs is waiting: when
reading terminal input, in sit-for
and sleep-for
(voir la section Waiting for Elapsed Time or Input), and in accept-process-output
(voir la section Accepting Output from Processes). This minimizes the problem of timing errors that usually plague
parallel programming. For example, you can safely create a process and only
then specify its buffer or filter function; no output can arrive before you
finish, if the code in between does not call any primitive that waits.
On some systems, when Emacs reads the output from a subprocess, the output
data is read in very small blocks, potentially resulting in very poor
performance. This behavior can be remedied to some extent by setting the
variable process-adaptive-read-buffering to a non-nil
value
(the default), as it will automatically delay reading from such processes,
thus allowing them to produce more output before Emacs tries to read it.
It is impossible to separate the standard output and standard error streams of the subprocess, because Emacs normally spawns the subprocess inside a pseudo-TTY, and a pseudo-TTY has only one output channel. If you want to keep the output to those streams separate, you should redirect one of them to a file—for example, by using an appropriate shell command.
37.9.1 Process Buffers | If no filter, output is put in a buffer. | |
37.9.2 Process Filter Functions | Filter functions accept output from the process. | |
37.9.3 Decoding Process Output | Filters can get unibyte or multibyte strings. | |
37.9.4 Accepting Output from Processes | How to wait until process output arrives. |
[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.