comparison man/lispref/processes.texi @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 376386a54a3c
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the XEmacs Lisp Reference Manual. 2 @c This is part of the XEmacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 @c See the file lispref.texi for copying conditions. 4 @c See the file lispref.texi for copying conditions.
5 @setfilename ../../info/processes.info 5 @setfilename ../../info/processes.info
6 @node Processes, System Interface, Databases, Top 6 @node Processes, System Interface, Databases, Top
7 @chapter Processes 7 @chapter Processes
8 @cindex child process 8 @cindex child process
90 @cindex program arguments 90 @cindex program arguments
91 All three of the subprocess-creating functions have a @code{&rest} 91 All three of the subprocess-creating functions have a @code{&rest}
92 argument, @var{args}. The @var{args} must all be strings, and they are 92 argument, @var{args}. The @var{args} must all be strings, and they are
93 supplied to @var{program} as separate command line arguments. Wildcard 93 supplied to @var{program} as separate command line arguments. Wildcard
94 characters and other shell constructs are not allowed in these strings, 94 characters and other shell constructs are not allowed in these strings,
95 since they are passed directly to the specified program. 95 since they are passed directly to the specified program.
96 96
97 @strong{Please note:} The argument @var{program} contains only the 97 @strong{Please note:} The argument @var{program} contains only the
98 name of the program; it may not contain any command-line arguments. You 98 name of the program; it may not contain any command-line arguments. You
99 must use @var{args} to provide those. 99 must use @var{args} to provide those.
100 100
104 @cindex environment variables, subprocesses 104 @cindex environment variables, subprocesses
105 The subprocess inherits its environment from XEmacs; but you can 105 The subprocess inherits its environment from XEmacs; but you can
106 specify overrides for it with @code{process-environment}. @xref{System 106 specify overrides for it with @code{process-environment}. @xref{System
107 Environment}. 107 Environment}.
108 108
109 @defvar exec-directory 109 @defvar exec-directory
110 @pindex wakeup 110 @pindex wakeup
111 The value of this variable is the name of a directory (a string) that 111 The value of this variable is the name of a directory (a string) that
112 contains programs that come with XEmacs, that are intended for XEmacs 112 contains programs that come with XEmacs, that are intended for XEmacs
113 to invoke. The program @code{wakeup} is an example of such a program; 113 to invoke. The program @code{wakeup} is an example of such a program;
114 the @code{display-time} command uses it to get a reminder once per 114 the @code{display-time} command uses it to get a reminder once per
294 The @code{shell-command-on-region} command uses 294 The @code{shell-command-on-region} command uses
295 @code{call-process-region} like this: 295 @code{call-process-region} like this:
296 296
297 @smallexample 297 @smallexample
298 @group 298 @group
299 (call-process-region 299 (call-process-region
300 start end 300 start end
301 shell-file-name ; @r{Name of program.} 301 shell-file-name ; @r{Name of program.}
302 nil ; @r{Do not delete region.} 302 nil ; @r{Do not delete region.}
303 buffer ; @r{Send output to @code{buffer}.} 303 buffer ; @r{Send output to @code{buffer}.}
304 nil ; @r{No redisplay during output.} 304 nil ; @r{No redisplay during output.}
305 "-c" command) ; @r{Arguments for the shell.} 305 "-c" command) ; @r{Arguments for the shell.}
702 702
703 You can send signals explicitly by calling the functions in this 703 You can send signals explicitly by calling the functions in this
704 section. XEmacs also sends signals automatically at certain times: 704 section. XEmacs also sends signals automatically at certain times:
705 killing a buffer sends a @code{SIGHUP} signal to all its associated 705 killing a buffer sends a @code{SIGHUP} signal to all its associated
706 processes; killing XEmacs sends a @code{SIGHUP} signal to all remaining 706 processes; killing XEmacs sends a @code{SIGHUP} signal to all remaining
707 processes. (@code{SIGHUP} is a signal that usually indicates that the 707 processes. (@code{SIGHUP} is a signal that indicates that the
708 user hung up the phone.) 708 connection between the user and the process is broken, for example if a
709 connection via a telephone line is hung up.)
709 710
710 Each of the signal-sending functions takes two optional arguments: 711 Each of the signal-sending functions takes two optional arguments:
711 @var{process-name} and @var{current-group}. 712 @var{process} and @var{current-group}.
712 713
713 The argument @var{process-name} must be either a process, the name of 714 The argument @var{process} must be either a process or a buffer,
714 one, or @code{nil}. If it is @code{nil}, the process defaults to the 715 the name of one, or @code{nil}. If it is @code{nil}, the process
715 process associated with the current buffer. An error is signaled if 716 defaults to the process associated with the current buffer. An error is
716 @var{process-name} does not identify a process. 717 signaled if @var{process} does not identify a process.
717 718
718 The argument @var{current-group} is a flag that makes a difference 719 The argument @var{current-group} is a flag that makes a difference
719 when you are running a job-control shell as an XEmacs subprocess. If it 720 when you are running a job-control shell as an XEmacs subprocess. If it
720 is non-@code{nil}, then the signal is sent to the current process-group 721 is non-@code{nil}, then the signal is sent to the current foreground
721 of the terminal that XEmacs uses to communicate with the subprocess. If 722 process group of the terminal that XEmacs uses to communicate with the
722 the process is a job-control shell, this means the shell's current 723 subprocess. If the process is a job-control shell, this means the
723 subjob. If it is @code{nil}, the signal is sent to the process group of 724 shell's current subjob. If it is @code{nil}, the signal is sent to the
724 the immediate subprocess of XEmacs. If the subprocess is a job-control 725 process group of the immediate subprocess of XEmacs. If the subprocess
725 shell, this is the shell itself. 726 is a job-control shell, this is the shell itself.
726 727
727 The flag @var{current-group} has no effect when a pipe is used to 728 The flag @var{current-group} has no effect when a pipe is used to
728 communicate with the subprocess, because the operating system does not 729 communicate with the subprocess, because the operating system does not
729 support the distinction in the case of pipes. For the same reason, 730 support the distinction in the case of pipes. For the same reason,
730 job-control shells won't work when a pipe is used. See 731 job-control shells won't work when a pipe is used. See
731 @code{process-connection-type} in @ref{Asynchronous Processes}. 732 @code{process-connection-type} in @ref{Asynchronous Processes}.
732 733
733 @defun interrupt-process &optional process-name current-group 734 Some of the functions below take a @var{signal} argument, which
734 This function interrupts the process @var{process-name} by sending the 735 identifies a signal to be sent. It must be either an integer or a
735 signal @code{SIGINT}. Outside of XEmacs, typing the ``interrupt 736 symbol which names the signal, like @code{SIGSEGV}.
736 character'' (normally @kbd{C-c} on some systems, and @code{DEL} on 737
737 others) sends this signal. When the argument @var{current-group} is 738 @defun process-send-signal signal &optional process current-group
738 non-@code{nil}, you can think of this function as ``typing @kbd{C-c}'' 739 This function sends the signal @var{signal} to the process @var{process}.
739 on the terminal by which XEmacs talks to the subprocess. 740 The following functions can be implemented in terms of
740 @end defun 741 @code{process-send-signal}.
741 742 @end defun
742 @defun kill-process &optional process-name current-group 743
743 This function kills the process @var{process-name} by sending the 744 @defun interrupt-process &optional process current-group
745 This function interrupts the process @var{process} by sending the signal
746 @code{SIGINT}. Outside of XEmacs, typing the ``interrupt character''
747 (normally @kbd{C-c}) sends this signal. When the argument
748 @var{current-group} is non-@code{nil}, you can think of this function as
749 ``typing @kbd{C-c}'' on the terminal by which XEmacs talks to the
750 subprocess.
751 @end defun
752
753 @defun kill-process &optional process current-group
754 This function kills the process @var{process} by sending the
744 signal @code{SIGKILL}. This signal kills the subprocess immediately, 755 signal @code{SIGKILL}. This signal kills the subprocess immediately,
745 and cannot be handled by the subprocess. 756 and cannot be handled by the subprocess.
746 @end defun 757 @end defun
747 758
748 @defun quit-process &optional process-name current-group 759 @defun quit-process &optional process current-group
749 This function sends the signal @code{SIGQUIT} to the process 760 This function sends the signal @code{SIGQUIT} to the process
750 @var{process-name}. This signal is the one sent by the ``quit 761 @var{process}. This signal is the one sent by the ``quit
751 character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside 762 character'' (usually @kbd{C-\}) when you are not inside XEmacs.
752 XEmacs. 763 @end defun
753 @end defun 764
754 765 @defun stop-process &optional process current-group
755 @defun stop-process &optional process-name current-group 766 This function stops the process @var{process} by sending the
756 This function stops the process @var{process-name} by sending the
757 signal @code{SIGTSTP}. Use @code{continue-process} to resume its 767 signal @code{SIGTSTP}. Use @code{continue-process} to resume its
758 execution. 768 execution.
759 769
760 On systems with job control, the ``stop character'' (usually @kbd{C-z}) 770 On systems with job control, the ``stop character'' (usually @kbd{C-z})
761 sends this signal (outside of XEmacs). When @var{current-group} is 771 sends this signal (outside of XEmacs). When @var{current-group} is
762 non-@code{nil}, you can think of this function as ``typing @kbd{C-z}'' 772 non-@code{nil}, you can think of this function as ``typing @kbd{C-z}''
763 on the terminal XEmacs uses to communicate with the subprocess. 773 on the terminal XEmacs uses to communicate with the subprocess.
764 @end defun 774 @end defun
765 775
766 @defun continue-process &optional process-name current-group 776 @defun continue-process &optional process current-group
767 This function resumes execution of the process @var{process} by sending 777 This function resumes execution of the process @var{process} by sending
768 it the signal @code{SIGCONT}. This presumes that @var{process-name} was 778 it the signal @code{SIGCONT}. This presumes that @var{process} was
769 stopped previously. 779 stopped previously.
770 @end defun 780 @end defun
771 781
772 @c Emacs 19 feature
773 @defun signal-process pid signal 782 @defun signal-process pid signal
774 This function sends a signal to process @var{pid}, which need not be 783 This function sends a signal to the process with process id @var{pid},
775 a child of XEmacs. The argument @var{signal} specifies which signal 784 which need not be a child of XEmacs. The argument @var{signal}
776 to send; it should be an integer. 785 specifies which signal to send.
777 @end defun 786 @end defun
778 787
779 @node Output from Processes 788 @node Output from Processes
780 @section Receiving Output from Processes 789 @section Receiving Output from Processes
781 @cindex process output 790 @cindex process output
1094 of event. 1103 of event.
1095 1104
1096 The string describing the event looks like one of the following: 1105 The string describing the event looks like one of the following:
1097 1106
1098 @itemize @bullet 1107 @itemize @bullet
1099 @item 1108 @item
1100 @code{"finished\n"}. 1109 @code{"finished\n"}.
1101 1110
1102 @item 1111 @item
1103 @code{"exited abnormally with code @var{exitcode}\n"}. 1112 @code{"exited abnormally with code @var{exitcode}\n"}.
1104 1113