elementary shell behavior: can kick off a foreground process and

handle signals
This commit is contained in:
Ava Apples Affine 2023-03-24 18:14:33 -07:00
parent 3b1ae0efd5
commit 99cb9e5a2e
Signed by: affine
GPG key ID: 3A4645B8CF806069
17 changed files with 619 additions and 167 deletions

View file

@ -19,7 +19,9 @@ use crate::segment::{Ctr, Seg, Type};
use crate::run::{run_callback, RUN_DOCSTRING};
use crate::sym::{Args, SymTable, Symbol, ValueType};
use std::rc::Rc;
use std::cell::RefCell;
pub mod posix;
pub mod append;
pub mod boolean;
pub mod control;
@ -613,7 +615,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
/// dynamic_stdlib
/// takes configuration data and uses it to insert dynamic
/// callbacks with configuration into a symtable
pub fn dynamic_stdlib(syms: &mut SymTable) -> Result<(), String> {
pub fn dynamic_stdlib(syms: &mut SymTable, shell: Option<Rc<RefCell<posix::ShellState>>>) -> Result<(), String> {
//get CFG_RELISH_ENV from syms
let env_cfg_user_form = syms
.call_symbol(&"CFG_RELISH_ENV".to_string(), &Seg::new(), true)
@ -637,5 +639,17 @@ pub fn dynamic_stdlib(syms: &mut SymTable) -> Result<(), String> {
},
);
if let Some(shell_state) = shell {
let posix_cfg_user_form = syms
.call_symbol(&"CFG_RELISH_POSIX".to_string(), &Seg::new(), true)
.unwrap_or_else(|_: String| Box::new(Ctr::None))
.to_string()
.eq("true");
if posix_cfg_user_form {
posix::load_posix_shell(syms, shell_state);
}
}
Ok(())
}