feat(runtime): add missing doc comments on Shell
Signed-off-by: Charlotte Meyer <dev@buffet.sh>
This commit is contained in:
parent
c0e5aa2308
commit
aeb61873c1
1 changed files with 5 additions and 0 deletions
|
@ -71,6 +71,8 @@ pub struct Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Shell {
|
impl Shell {
|
||||||
|
/// Create a new shell.
|
||||||
|
/// This also sets up the *global* signal handlers.
|
||||||
pub fn new() -> Result<Shell, nix::Error> {
|
pub fn new() -> Result<Shell, nix::Error> {
|
||||||
let ignore = SigAction::new(SigHandler::SigIgn, SaFlags::empty(), SigSet::empty());
|
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 {
|
pub fn is_running(&self) -> bool {
|
||||||
self.is_running
|
self.is_running
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Runs a given program.
|
||||||
pub fn run<'a>(&mut self, code: &'a ast::Code) -> Result<Status, RuntimeError> {
|
pub fn run<'a>(&mut self, code: &'a ast::Code) -> Result<Status, RuntimeError> {
|
||||||
let mut last_status = Status::SUCCESS;
|
let mut last_status = Status::SUCCESS;
|
||||||
|
|
||||||
|
@ -101,6 +105,7 @@ impl Shell {
|
||||||
Ok(last_status)
|
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> {
|
pub fn run_subshell<'a>(&mut self, code: &'a ast::Code) -> Result<OsString, RuntimeError> {
|
||||||
let (output, input) =
|
let (output, input) =
|
||||||
unistd::pipe2(OFlag::empty()).map_err(RuntimeError::PipeCreationFailed)?;
|
unistd::pipe2(OFlag::empty()).map_err(RuntimeError::PipeCreationFailed)?;
|
||||||
|
|
Loading…
Reference in a new issue