GNU Info

Info Node: (librep.info)Process I/O

(librep.info)Process I/O


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

Process I/O
-----------

   It is only possible for lisp programs to explicitly send input data
to _asynchronous_ processes (by the time it's possible to call a
function to send data to a synchronous process, the process will
already have terminated!). Simply use the process object which an
asynchronous process is running on as a normal Lisp input stream, any
strings or characters written to the stream will immediately be copied
to the `stdin' channel of the subprocess.

   With synchronous processes, the only control over input data possible
is by giving the `call-process' function the name of a file containing
the subprocess' input data.

   Output data from subprocesses is handled the same way by both
asynchronous and synchronous processes: it is simply copied to the
stream defined by the output stream component of the subprocess'
process object.

 - Function: process-output-stream process
     Returns the value of the output stream component of the process
     object PROCESS.

 - Function: set-process-output-stream process stream
     Sets the value of the output stream component of the process object
     PROCESS to the stream STREAM, then returns STREAM.

   By default the `stdout' and `stderr' streams are combined, use the
`set-process-error-stream' function to separate them.  (Note that this
currently only works with `pipe' connection types.)

 - Function: process-error-stream process
     Returns the value of the error stream component of the process
     object PROCESS.

 - Function: set-process-error-stream process stream
     Sets the value of the error stream component of the process object
     PROCESS to the stream STREAM, then returns STREAM.

   Output from asynchronous subprocesses (this includes changes of state
as well as stream output) is only propagated at well-defined times.
Either when in the read stage of the read-eval-print, or input, loop,
or when the `accept-process-output' or `sit-for' functions are called.

 - Function: accept-process-output #!optional seconds milliseconds
     Wait SECONDS plus MILLISECONDS for output from any asynchronous
     subprocesses. If any arrives, process it, then return false.
     Otherwise return true. If either of the arguments is undefined,
     they count as zero in the addition.

 - Function: sit-for #!optional seconds milliseconds
     Wait for input to arrive and be processed. No more than SECONDS
     seconds plus MILLISECONDS milliseconds will be waited. If at the
     end of this time no input has arrived, return true. Otherwise
     return false if input was found.

     Note that this function is only distinct to
     `accept-process-output' when `librep' is embedded in another
     application, or an extension has been loaded that provides an event
     loop (such as the `gtk' binding). In this case other input forms,
     such as user input, for example, can preempt the timeout.

     This function is exported by the `rep.system' module.

   Note: Streams.


automatically generated by info2www version 1.2.2.9