gsh/evaluator/runner
The runner module orchestrates the compilation and execution of the shell’s
dynamically generated code.
It acts as the coordinator between the external system (using shellout to
invoke the Gleam compiler) and the internal Erlang VM (using the runtime
FFI to dynamically load and execute the resulting .beam bytecode).
Values
pub fn build_project() -> Result(String, #(Int, String))
Triggers a full compilation of the host project using the Gleam CLI.
This is used when the user types the compile command in the REPL,
allowing them to rebuild their background application without leaving the shell.
pub fn run(
binding: option.Option(binding.Binding),
module_name: String,
) -> result.Evaluation
The core execution pipeline for evaluated code.
- Uses
shelloutto rungleam build --target erlang. This compiles the temporarygsh_eval.gleamfile into a.beamfile without booting a new VM. - If compilation succeeds, it uses the
runtimeFFI to hot-loadgsh_eval.beaminto the current VM and executes thegsh_entryfunction. - Catches and formats any compiler or runtime errors into a safe
Evaluationrecord.