diff --git a/crates/oyster_runtime/src/lib.rs b/crates/oyster_runtime/src/lib.rs index b301371..5dd6e61 100644 --- a/crates/oyster_runtime/src/lib.rs +++ b/crates/oyster_runtime/src/lib.rs @@ -71,6 +71,8 @@ pub struct Shell { } impl Shell { + /// Create a new shell. + /// This also sets up the *global* signal handlers. pub fn new() -> Result { let ignore = SigAction::new(SigHandler::SigIgn, SaFlags::empty(), SigSet::empty()); @@ -85,10 +87,12 @@ impl Shell { }) } + /// Returns true if the shell is supposed to still be running. pub fn is_running(&self) -> bool { self.is_running } + /// Runs a given program. pub fn run<'a>(&mut self, code: &'a ast::Code) -> Result { let mut last_status = Status::SUCCESS; @@ -101,6 +105,7 @@ impl Shell { Ok(last_status) } + /// Runs a given program in a seperate process, and returns its output. pub fn run_subshell<'a>(&mut self, code: &'a ast::Code) -> Result { let (output, input) = unistd::pipe2(OFlag::empty()).map_err(RuntimeError::PipeCreationFailed)?;