feat(runtime): add missing doc comments on Shell

Signed-off-by: Charlotte Meyer <dev@buffet.sh>
This commit is contained in:
buffet 2022-10-26 14:35:45 +00:00
parent c0e5aa2308
commit aeb61873c1

View file

@ -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<Shell, nix::Error> {
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<Status, RuntimeError> {
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<OsString, RuntimeError> {
let (output, input) =
unistd::pipe2(OFlag::empty()).map_err(RuntimeError::PipeCreationFailed)?;