Struct representing the result of executing a command in a sandbox.
Fields
stdout- Standard output from the commandstderr- Standard error from the commandexit_code- Exit code of the command (0 typically means success)
Examples
%Puck.Sandbox.Runtime.ExecResult{
stdout: "hello world",
stderr: "",
exit_code: 0
}
Summary
Functions
Creates a new ExecResult with the given attributes.
Returns the output (stdout if present, otherwise stderr).
Returns true if the command executed successfully (exit code 0).
Types
@type t() :: %Puck.Sandbox.Runtime.ExecResult{ exit_code: non_neg_integer(), stderr: String.t(), stdout: String.t() }
Functions
Creates a new ExecResult with the given attributes.
Examples
iex> Puck.Sandbox.Runtime.ExecResult.new(stdout: "hello", exit_code: 0)
%Puck.Sandbox.Runtime.ExecResult{stdout: "hello", stderr: "", exit_code: 0}
Returns the output (stdout if present, otherwise stderr).
Useful when you just want the command output regardless of stream.
Examples
iex> result = Puck.Sandbox.Runtime.ExecResult.new(stdout: "hello", exit_code: 0)
iex> Puck.Sandbox.Runtime.ExecResult.output(result)
"hello"
iex> result = Puck.Sandbox.Runtime.ExecResult.new(stderr: "error message", exit_code: 1)
iex> Puck.Sandbox.Runtime.ExecResult.output(result)
"error message"
Returns true if the command executed successfully (exit code 0).
Examples
iex> result = Puck.Sandbox.Runtime.ExecResult.new(exit_code: 0)
iex> Puck.Sandbox.Runtime.ExecResult.success?(result)
true
iex> result = Puck.Sandbox.Runtime.ExecResult.new(exit_code: 1)
iex> Puck.Sandbox.Runtime.ExecResult.success?(result)
false