ej_io/lib.rs
1//! Async process execution and I/O management for the EJ framework.
2//!
3//! Provides async utilities for spawning, monitoring, and controlling external processes
4//! with real-time output capture and timeout handling using tokio.
5//!
6//! # Usage
7//!
8//! ```rust
9//! use ej_io::runner::{Runner, RunEvent};
10//! use std::sync::{Arc, atomic::AtomicBool};
11//! use tokio::sync::mpsc;
12//!
13//! #[tokio::main]
14//! async fn main() {
15//! // Create a process runner
16//! let runner = Runner::new("echo", vec!["Hello, World!"]);
17//! let (tx, mut rx) = mpsc::channel(100);
18//! let should_stop = Arc::new(AtomicBool::new(false));
19//!
20//! // Run the process with event handling
21//! let exit_status = runner.run(tx, should_stop).await;
22//!
23//! // Handle events asynchronously
24//! while let Some(event) = rx.recv().await {
25//! match event {
26//! RunEvent::ProcessNewOutputLine(line) => println!("Output: {}", line),
27//! RunEvent::ProcessEnd(success) => println!("Process ended: {}", success),
28//! _ => {}
29//! }
30//! }
31//! }
32//! ```
33
34pub mod process;
35pub mod runner;