Process channels

Author(s): Jose F. Morales.

This module provides an abstraction for communication channels between processes (process) based on standard input/output/error streams.

Usage and interface

Documentation on exports

default
the default descriptor
null
the null stream (see dev_null/1)
pipe(-Stream)
a pipe (Stream unified with the parent's read/write end of the pipe)
file(+File)
a file File
stream(+Stream)
a stream Stream (must be opened with the right mode)
file_append(+File)
a file File, where writes are appended to the end
string(?String)
a string (list of codes)
line(?Line)
a string, ignoring trailing new line character
atmlist(?Xs)
a list of atoms (for each line)
terms(?Xs)
terms, ended in full-stop (using read_term/3 and write_canonical/2)
stdout
(only valid for stderr(_)) redirect to the same channel than stdout (useful for redirecting both standard output and standard error).

Usage:process_channel(Channel)

A communication channel for standard file descriptors

    Usage:channel_bindings(Channels,ChannelBinds)

    Create channel bindings (taking into account pipes)

      Usage:cleanup_binding(ChannelB)

      Cleanup temporaries due to channel file-based bindings.

        Usage:binding_port_call(ChannelB)

        Do port_call/1 on the result of channel transfer (send or receive).

          PREDICATEsend_input/2

          Usage:send_input(Mode,ChannelBinding)

          Send input through channel binding ChannelBinding. Transfer status is internally stored (see binding_port_call/1).

            Usage:receive_output(Mode,ChannelBinding)

            Receive output from channel binding ChannelBinding. Transfer status is internally stored (see binding_port_call/1).

              Usage:open_redirect(ChannelB,Mode,S)

              Open stream file redirections (for internals:'$exec'/9).

                Usage:close_redirect(ChannelB,S)

                Close stream file redirections (for internals:'$exec'/9).

                  Documentation on imports

                  This module has the following direct dependencies:

                  Known bugs and planned improvements

                  • (feature) Generalize channel marshalling
                  • (feature) Asynchronous data transfer is not really asynchronous