diff --git a/src/bin/relish.rs b/src/bin/relish.rs index 73e7aaa..1268382 100644 --- a/src/bin/relish.rs +++ b/src/bin/relish.rs @@ -246,9 +246,23 @@ fn main() { load_defaults(&mut syms); load_environment(&mut syms); static_stdlib(&mut syms); - // reload this later with the state bindings + #[cfg(feature="posix")] - dynamic_stdlib(&mut syms, None); + let prompt_ss: Rc>; + #[cfg(feature="posix")] + { + let shell_state_bindings = Rc::new(RefCell::from(ShellState { + parent_pid: unistd::Pid::from_raw(0), + parent_sid: unistd::Pid::from_raw(0), + children: vec![], + last_exit_code: 0, + attr: None, + })); + prompt_ss = shell_state_bindings.clone(); + dynamic_stdlib(&mut syms, Some(shell_state_bindings)); + } + + // reload this later with the state bindings #[cfg(not(feature="posix"))] dynamic_stdlib(&mut syms); @@ -271,19 +285,9 @@ fn main() { .unwrap_or_else(|err: Traceback| eprintln!("failed to load script {}\n{}", cfg_file, err)); } - #[cfg(feature="posix")] - let prompt_ss: Rc>; #[cfg(feature="posix")] { - let shell_state_bindings = Rc::new(RefCell::from(ShellState { - parent_pid: unistd::Pid::from_raw(0), - parent_sid: unistd::Pid::from_raw(0), - children: vec![], - last_exit_code: 0, - attr: None, - })); - prompt_ss = shell_state_bindings.clone(); - dynamic_stdlib(&mut syms, Some(shell_state_bindings)); + dynamic_stdlib(&mut syms, Some(prompt_ss.clone())); } // setup readline