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

REGTYPE
  • default: the default descriptor
  • null: the null stream (/dev/null file in POSIX, nul in Windows)
  • 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

      PREDICATE

      Usage:channel_bindings(Channels,ChannelBinds)

      Create channel bindings (taking into account pipes)

        PREDICATE

        Usage:cleanup_binding(ChannelB)

        Cleanup temporaries due to channel file-based bindings.

          PREDICATE

          Usage:binding_port_call(ChannelB)

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

            PREDICATE

            Usage:send_input(Mode,ChannelBinding)

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

              PREDICATE

              Usage:receive_output(Mode,ChannelBinding)

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

                PREDICATE

                Usage:open_redirect(ChannelB,Mode,S)

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

                  PREDICATE

                  Usage:close_redirect(ChannelB,S)

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

                    Known bugs and planned improvements

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