Bash.AST.Coproc (Bash v0.3.0)

Copy Markdown View Source

Coproc AST node.

Represents coproc [NAME] command where command can be simple or compound.

When a NAME is provided (only valid with compound commands in real bash), the coproc array variable and PID variable use that name. Otherwise, the default name "COPROC" is used.

Simple commands are executed via ExCmd.Process (external OS process). Compound commands are executed within the Elixir bash interpreter in a spawned BEAM process with message-passing I/O.

Examples

# coproc cat
%Coproc{body: %Command{name: "cat"}}

# coproc MYPROC { cat; }
%Coproc{name: "MYPROC", body: %Compound{kind: :group, ...}}

Summary

Types

t()

@type t() :: %Bash.AST.Coproc{
  body: Bash.Statement.t(),
  exit_code: 0..255 | nil,
  meta: Bash.AST.Meta.t(),
  name: String.t(),
  state_updates: map()
}

Functions

execute(ast, stdin, session_state)