43 |
* Input to Processes:: Sending input to an asynchronous subprocess. |
* Input to Processes:: Sending input to an asynchronous subprocess. |
44 |
* Signals to Processes:: Stopping, continuing or interrupting |
* Signals to Processes:: Stopping, continuing or interrupting |
45 |
an asynchronous subprocess. |
an asynchronous subprocess. |
|
* Query Before Exit:: Whether to query if exiting will kill a process. |
|
46 |
* Output from Processes:: Collecting output from an asynchronous subprocess. |
* Output from Processes:: Collecting output from an asynchronous subprocess. |
47 |
* Sentinels:: Sentinels run when process run-status changes. |
* Sentinels:: Sentinels run when process run-status changes. |
48 |
|
* Query Before Exit:: Whether to query if exiting will kill a process. |
49 |
* Transaction Queues:: Transaction-based communication with subprocesses. |
* Transaction Queues:: Transaction-based communication with subprocesses. |
50 |
* Network:: Opening network connections. |
* Network:: Opening network connections. |
51 |
@end menu |
@end menu |
460 |
addition, the total number of @sc{pty}s is limited on many systems and |
addition, the total number of @sc{pty}s is limited on many systems and |
461 |
it is good not to waste them. |
it is good not to waste them. |
462 |
|
|
463 |
The value of @code{process-connection-type} is used when |
The value of @code{process-connection-type} takes effect when |
464 |
@code{start-process} is called. So you can specify how to communicate |
@code{start-process} is called. So you can specify how to communicate |
465 |
with one subprocess by binding the variable around the call to |
with one subprocess by binding the variable around the call to |
466 |
@code{start-process}. |
@code{start-process}. |
486 |
but not necessarily right away. You can delete a process explicitly |
but not necessarily right away. You can delete a process explicitly |
487 |
at any time. If you delete a terminated process explicitly before it |
at any time. If you delete a terminated process explicitly before it |
488 |
is deleted automatically, no harm results. Deletion of a running |
is deleted automatically, no harm results. Deletion of a running |
489 |
process sends a signal to terminate it and calls the process sentinel |
process sends a signal to terminate it (and its child processes if |
490 |
if it has one. |
any), and calls the process sentinel if it has one. |
491 |
|
|
492 |
@code{get-buffer-process} and @code{process-list} do not remember a |
@code{get-buffer-process} and @code{process-list} do not remember a |
493 |
deleted process, but the process object itself continues to exist as |
deleted process, but the process object itself continues to exist as |
855 |
to send; it should be an integer. |
to send; it should be an integer. |
856 |
@end defun |
@end defun |
857 |
|
|
|
@node Query Before Exit |
|
|
@section Querying Before Exit |
|
|
|
|
|
When Emacs exits, it terminates all its subprocesses by sending them |
|
|
the @code{SIGHUP} signal. Because some subprocesses are doing |
|
|
valuable work, Emacs normally asks the user to confirm that it is ok |
|
|
to terminate them. Each process has a query flag which, if |
|
|
non-@code{nil}, says that Emacs should ask for confirmation before |
|
|
exiting and thus killing that process. The default for the query flag |
|
|
is @code{t}, meaning @emph{do} query. |
|
|
|
|
|
@tindex process-query-on-exit-flag |
|
|
@defun process-query-on-exit-flag process |
|
|
This returns the query flag of @var{process}. |
|
|
@end defun |
|
|
|
|
|
@tindex set-process-query-on-exit-flag |
|
|
@defun set-process-query-on-exit-flag process flag |
|
|
This function sets the query flag of @var{process} to @var{flag}. It |
|
|
returns @var{flag}. |
|
|
|
|
|
@smallexample |
|
|
@group |
|
|
;; @r{Don't query about the shell process} |
|
|
(set-process-query-on-exit-flag (get-process "shell") nil) |
|
|
@result{} t |
|
|
@end group |
|
|
@end smallexample |
|
|
@end defun |
|
|
|
|
|
@defun process-kill-without-query process &optional do-query |
|
|
This function clears the query flag of @var{process}, so that |
|
|
Emacs will not query the user on account of that process. |
|
|
|
|
|
Actually, the function does more than that: it returns the old value of |
|
|
the process's query flag, and sets the query flag to @var{do-query}. |
|
|
Please don't use this function to do those things any more---please |
|
|
use the newer, cleaner functions @code{process-query-on-exit-flag} and |
|
|
@code{set-process-query-on-exit-flag} in all but the simplest cases. |
|
|
The only way you should use @code{process-kill-without-query} nowadays |
|
|
is like this: |
|
|
|
|
|
@smallexample |
|
|
@group |
|
|
;; @r{Don't query about the shell process} |
|
|
(process-kill-without-query (get-process "shell")) |
|
|
@end group |
|
|
@end smallexample |
|
|
@end defun |
|
|
|
|
858 |
@node Output from Processes |
@node Output from Processes |
859 |
@section Receiving Output from Processes |
@section Receiving Output from Processes |
860 |
@cindex process output |
@cindex process output |
867 |
the process has no buffer and no filter function, its output is |
the process has no buffer and no filter function, its output is |
868 |
discarded. |
discarded. |
869 |
|
|
870 |
|
When a subprocess terminates, Emacs reads any pending output, |
871 |
|
then stops reading output from that subprocess. Therefore, if the |
872 |
|
subprocess has children that are still live and still producing |
873 |
|
output, Emacs won't receive that output. |
874 |
|
|
875 |
Output from a subprocess can arrive only while Emacs is waiting: when |
Output from a subprocess can arrive only while Emacs is waiting: when |
876 |
reading terminal input, in @code{sit-for} and @code{sleep-for} |
reading terminal input, in @code{sit-for} and @code{sleep-for} |
877 |
(@pxref{Waiting}), and in @code{accept-process-output} (@pxref{Accepting |
(@pxref{Waiting}), and in @code{accept-process-output} (@pxref{Accepting |
1300 |
was not. |
was not. |
1301 |
@end defun |
@end defun |
1302 |
|
|
1303 |
|
@node Query Before Exit |
1304 |
|
@section Querying Before Exit |
1305 |
|
|
1306 |
|
When Emacs exits, it terminates all its subprocesses by sending them |
1307 |
|
the @code{SIGHUP} signal. Because some subprocesses are doing |
1308 |
|
valuable work, Emacs normally asks the user to confirm that it is ok |
1309 |
|
to terminate them. Each process has a query flag which, if |
1310 |
|
non-@code{nil}, says that Emacs should ask for confirmation before |
1311 |
|
exiting and thus killing that process. The default for the query flag |
1312 |
|
is @code{t}, meaning @emph{do} query. |
1313 |
|
|
1314 |
|
@tindex process-query-on-exit-flag |
1315 |
|
@defun process-query-on-exit-flag process |
1316 |
|
This returns the query flag of @var{process}. |
1317 |
|
@end defun |
1318 |
|
|
1319 |
|
@tindex set-process-query-on-exit-flag |
1320 |
|
@defun set-process-query-on-exit-flag process flag |
1321 |
|
This function sets the query flag of @var{process} to @var{flag}. It |
1322 |
|
returns @var{flag}. |
1323 |
|
|
1324 |
|
@smallexample |
1325 |
|
@group |
1326 |
|
;; @r{Don't query about the shell process} |
1327 |
|
(set-process-query-on-exit-flag (get-process "shell") nil) |
1328 |
|
@result{} t |
1329 |
|
@end group |
1330 |
|
@end smallexample |
1331 |
|
@end defun |
1332 |
|
|
1333 |
|
@defun process-kill-without-query process &optional do-query |
1334 |
|
This function clears the query flag of @var{process}, so that |
1335 |
|
Emacs will not query the user on account of that process. |
1336 |
|
|
1337 |
|
Actually, the function does more than that: it returns the old value of |
1338 |
|
the process's query flag, and sets the query flag to @var{do-query}. |
1339 |
|
Please don't use this function to do those things any more---please |
1340 |
|
use the newer, cleaner functions @code{process-query-on-exit-flag} and |
1341 |
|
@code{set-process-query-on-exit-flag} in all but the simplest cases. |
1342 |
|
The only way you should use @code{process-kill-without-query} nowadays |
1343 |
|
is like this: |
1344 |
|
|
1345 |
|
@smallexample |
1346 |
|
@group |
1347 |
|
;; @r{Don't query about the shell process} |
1348 |
|
(process-kill-without-query (get-process "shell")) |
1349 |
|
@end group |
1350 |
|
@end smallexample |
1351 |
|
@end defun |
1352 |
|
|
1353 |
@node Transaction Queues |
@node Transaction Queues |
1354 |
@section Transaction Queues |
@section Transaction Queues |
1355 |
@cindex transaction queue |
@cindex transaction queue |