Bash.ExecutionResult protocol (Bash v0.3.0)

Copy Markdown View Source

Protocol for extracting execution results from various result types.

This protocol provides a unified interface for both:

  • CommandResult structs (which still have output for external commands)
  • AST nodes with embedded execution results (output goes to sinks)

Note: stdout/stderr/all_output functions return results from the collector for Script types, and empty strings for AST nodes since output goes to sinks.

Summary

Types

t()

All the types that implement this protocol.

Functions

Get all output as a string

Get exit code

Get stderr output as a string

Get stdout output as a string

Check if execution was successful (exit code 0)

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

all_output(result)

@spec all_output(t()) :: String.t()

Get all output as a string

exit_code(result)

@spec exit_code(t()) :: non_neg_integer() | nil

Get exit code

stderr(result)

@spec stderr(t()) :: String.t()

Get stderr output as a string

stdout(result)

@spec stdout(t()) :: String.t()

Get stdout output as a string

success?(result)

@spec success?(t()) :: boolean()

Check if execution was successful (exit code 0)