openrunner_rs/
lib.rs

1//! # OpenRunner
2//!
3//! A Rust library for running OpenScript code with fine-grained control over execution,
4//! I/O, environment, and process lifecycle.
5//!
6//! ## Features
7//!
8//! - Run OpenScript code from Rust (string or file)
9//! - Full async support with tokio
10//! - Fine-grained control over I/O, environment, working directory, timeout, and more
11//! - Spawn OpenScript processes for long-running jobs
12//! - Convenience macros for quick scripting
13//! - Designed to integrate seamlessly with OpenScript workflows
14//!
15//! ## Quick Start
16//!
17//! ```rust
18//! use openrunner_rs::{run, ScriptOptions};
19//!
20//! # #[tokio::main]
21//! # async fn main() -> openrunner_rs::Result<()> {
22//! let options = ScriptOptions::new().openscript_path("/bin/sh");
23//! let result = run(r#"echo "Hello from OpenRunner!""#, options).await?;
24//! println!("Output: {}", result.stdout);
25//! # Ok(())
26//! # }
27//! ```
28//!
29//! ## Advanced Usage
30//!
31//! ```rust
32//! use openrunner_rs::{run, ScriptOptions};
33//! use std::time::Duration;
34//!
35//! # #[tokio::main]
36//! # async fn main() -> openrunner_rs::Result<()> {
37//! let options = ScriptOptions::new()
38//!     .openscript_path("/bin/sh")
39//!     .timeout(Duration::from_secs(30))
40//!     .env("MY_VAR", "custom_value")
41//!     .args(vec!["arg1".to_string(), "arg2".to_string()]);
42//!     
43//! let result = run("echo $MY_VAR $1 $2", options).await?;
44//! println!("Result: {}", result.stdout);
45//! # Ok(())
46//! # }
47//! ```
48
49pub mod error;
50pub mod macros;
51pub mod runner;
52pub mod types;
53
54pub use error::{Error, Result};
55pub use runner::{run, run_file, spawn, spawn_file};
56pub use types::{ExecResult, ScriptOptions, SpawnResult};
57pub use tokio::process::Child;