GNU Info

Info Node: (librep.info)Asynchronous Processes

(librep.info)Asynchronous Processes


Next: Synchronous Processes Prev: Process Objects Up: Processes
Enter node , (file) or (file)node

Asynchronous Processes
----------------------

   An "asynchronous process" is one that runs in parallel with Lisp
evaluation, basically this means that once the subprocess has been
started (by the `start-process' function) `librep' will carry on as
normal.

   The event loop checks for output from asynchronous processes, any
found is copied to the process' output stream, and calls the the
process' state change function when necessary (Note: Process States).
Alternatively the `accept-process-output' function can be called to
explicitly allow output to be processed.

   When using asynchronous processes you have a choice as to the Unix
mechanism used to connect the `stdin', `stdout' and `stderr' streams of
the subprocess to `librep''s process.

   The two options currently available are pipes or pseudo-terminals; in
general pseudo-terminals should only be used to provide a direct
interface between the user and a process (i.e. the `*shell*' buffer)
since they allow job control to work properly. At other times pipes
will be more efficient and are used by default. However, there are
cases where the buffering characteristics of pipes mean that ptys must
be used.

 - Function: start-process #!optional process program #!rest args
     This function starts an asynchronous subprocess running on the
     process object PROCESS. If PROCESS is undefined a new process
     object is created (by calling the function `make-process' with all
     arguments undefined).

     The function always returns the process object which the
     subprocess has been started on. If for some reason the subprocess
     can't be created an error of type `process-error' is signalled.

     The optional argument PROGRAM is a string defining the name of the
     program to execute, it will be searched for in all the directories
     in the `PATH' environment variable. The ARGS are strings to pass
     to the subprocess as its arguments.

     When defined, the optional arguments overrule the values of the
     related components of the process object.

     The following example runs the `ls' program asynchronously, its
     output is sent to the `standard-output' stream.

          (let
              ((process (make-process standard-output)))
            (start-process process "ls" "-s"))

   Note that when `librep' exits it kills all of its asynchronous
subprocesses which are still running without warning.

 - Function: process-connection-type process
     Returns the value of the connection type component of the process
     object PROCESS. See the documentation of the
     `set-process-connection-type' function for the values this may
     take.

 - Function: set-process-connection-type process symbol
     Sets the value of the connection type component of the process
     object PROCESS to SYMBOL, then returns SYMBOL.

     SYMBOL should be one of the following symbols,

    `pty'
          Use pseudo-terminals to connect to subprocesses running
          asynchronously on this process object.

    `pipe'
          Use standard Unix pipes to connect, this is the default value
          of this component.

    `socketpair'
          Uses a connected pair of sockets.

   Note that currently only the `pipe' connection type allows the
normal and error output streams of the process to be separated.


automatically generated by info2www version 1.2.2.9