Elixir v1.3.0-rc.0 Port View Source

Functions related to Erlang ports.

Link to this section Summary

Functions

Makes a synchronous call to the port and returns its reply as a term

Closes the port

Sends data to the port driver port

Associates the port identifier with a pid

Sends a synchronous control command to the port and returns its reply as a binary

Returns information about the port or nil if the port is closed

Returns information about the port or nil if the port is closed

Returns a list of the ports for the current node

Opens an Erlang port given a tuple name and a list of settings

Link to this section Types

Link to this type name() View Source
name ::
  {:spawn, charlist | binary} |
  {:spawn_driver, charlist | binary} |
  {:spawn_executable, charlist | atom} |
  {:fd, non_neg_integer, non_neg_integer}

Link to this section Functions

Link to this function call(port, operation, data) View Source
call(port, integer, term) :: term

Makes a synchronous call to the port and returns its reply as a term.

Not all port drivers support this control feature.

For more information, see :erlang.port_call/3.

Inlined by the compiler.

Link to this function close(port) View Source
close(port) :: true

Closes the port.

For more information, see :erlang.port_close/1.

Inlined by the compiler.

Link to this function command(port, data, options \\ []) View Source
command(port, iodata, [:force | :nosuspend]) :: boolean

Sends data to the port driver port.

For more information, see :erlang.port_command/2.

Inlined by the compiler.

Link to this function connect(port, pid) View Source
connect(port, pid) :: true

Associates the port identifier with a pid.

For more information, see :erlang.port_connect/2.

Inlined by the compiler.

Link to this function control(port, operation, data) View Source
control(port, integer, iodata) :: iodata | binary

Sends a synchronous control command to the port and returns its reply as a binary.

Not all port drivers support this feature.

For more information, see :erlang.port_control/3.

Inlined by the compiler.

Returns information about the port or nil if the port is closed.

For more information, see :erlang.port_info/1.

Link to this function info(port, spec) View Source
info(port, atom) :: {atom, term} | nil

Returns information about the port or nil if the port is closed.

For more information, see :erlang.port_info/2.

Returns a list of the ports for the current node.

For more information, see :erlang.ports/0.

Inlined by the compiler.

Link to this function open(name, settings) View Source
open(name, list) :: port

Opens an Erlang port given a tuple name and a list of settings.

Name

The supported values for name are:

  • {:spawn, command} - to run an external program. The first space separated word of command will be considered as the name of the program to run, so use {:spawn_executable, command} to run a program having spaces in its name.
  • {:spawn_driver, command} - similar to {:spawn, command}, but to run a loaded driver.
  • {:spawn_executable, filename} - similar to {:spawn, filename}, but to run an external executable. With this option, filename in its whole is considered the name of the program to execute.
  • {:fd, fd_in, fd_out} - to access file descriptors used by Erlang, fd_in being used for standard input, fd_out for standard output.

For more information, see :erlang.open_port/2.

Inlined by the compiler.