Go to the first, previous, next, last section, table of contents.


Asynchronous Processes

An asynchronous process is one that runs in parallel with the editor, basically this means that once the subprocess has been started (by the start-process function) Jade 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 (see section Process States).

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 Jade's process (note that whatever the choice stdout and stderr always go to the same place).

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.

Function: start-process &optional process-object program &rest args
This function starts an asynchronous subprocess running on the process object process-object. If process-object 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 inserted into the current buffer.

(let
    ((process (make-process (current-buffer))))
  (start-process process "ls" "-s"))

Note that when Jade terminates 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.


Go to the first, previous, next, last section, table of contents.