fall back on shell command behaviour for undefined variables

Signed-off-by: Ava Hahn <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2023-10-12 20:50:27 -07:00
parent 0babc1986a
commit c05b94e92a
5 changed files with 84 additions and 15 deletions

View file

@ -60,6 +60,8 @@ use {
},
};
pub const POSIX_LOAD_NAME: &str = "load";
pub struct ShellState {
pub parent_pid: Pid,
pub parent_sid: Pid,
@ -190,7 +192,7 @@ fn launch_command(
.stdin(infd)
.stdout(outfd)
.stderr(errfd)
.process_group(0)
.process_group(0)
.spawn();
}
@ -273,7 +275,7 @@ const LOAD_DOCSTRING: &str = "Calls a binary off disk with given arguments.
Arguments may be of any type except lambda. If a symbol is not defined it will be passed as a string.
first argument (command name) will be found on path (or an error returned).
examples:
examples:call
(l ping google.com)
(let ((ping-count 4))
(l ping -c ping-count google.com))
@ -787,7 +789,7 @@ pub fn load_posix_shell(syms: &mut SymTable, shell_state: Rc<RefCell<ShellState>
syms.insert(
String::from("l"),
Symbol {
name: String::from("load"),
name: String::from(POSIX_LOAD_NAME),
args: Args::Infinite,
conditional_branches: true,
docs: String::from(LOAD_DOCSTRING),
@ -799,9 +801,9 @@ pub fn load_posix_shell(syms: &mut SymTable, shell_state: Rc<RefCell<ShellState>
);
syms.insert(
String::from("load"),
String::from(POSIX_LOAD_NAME),
Symbol {
name: String::from("load"),
name: String::from(POSIX_LOAD_NAME),
args: Args::Infinite,
conditional_branches: true,
docs: String::from(LOAD_DOCSTRING),