Skip to main content

frost_exec/
lib.rs

1//! Command execution engine for frost.
2//!
3//! Takes an AST produced by `frost-parser` and executes it, managing
4//! processes, pipelines, redirections, and the shell environment.
5//!
6//! Platform-specific system calls are isolated in the [`sys`] module
7//! so the rest of the engine remains portable across Unix variants.
8
9pub mod env;
10pub mod execute;
11pub mod job;
12pub mod redirect;
13pub mod sys;
14
15pub use env::ShellEnv;
16pub use execute::Executor;
17pub use job::{Job, JobTable};
18
19/// Convenience entry point: create a fresh environment, execute the
20/// program, and return the exit status.
21pub fn execute(program: &frost_parser::ast::Program) -> i32 {
22    let mut env = ShellEnv::new();
23    let mut executor = Executor::new(&mut env);
24    executor.execute_program(program).unwrap_or(1)
25}