Load stdlib with shell state ahead of configuration
This commit is contained in:
parent
981df23ea2
commit
a9cc38826e
1 changed files with 17 additions and 13 deletions
|
|
@ -246,9 +246,23 @@ fn main() {
|
||||||
load_defaults(&mut syms);
|
load_defaults(&mut syms);
|
||||||
load_environment(&mut syms);
|
load_environment(&mut syms);
|
||||||
static_stdlib(&mut syms);
|
static_stdlib(&mut syms);
|
||||||
// reload this later with the state bindings
|
|
||||||
#[cfg(feature="posix")]
|
#[cfg(feature="posix")]
|
||||||
dynamic_stdlib(&mut syms, None);
|
let prompt_ss: Rc<RefCell<ShellState>>;
|
||||||
|
#[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"))]
|
#[cfg(not(feature="posix"))]
|
||||||
dynamic_stdlib(&mut syms);
|
dynamic_stdlib(&mut syms);
|
||||||
|
|
||||||
|
|
@ -271,19 +285,9 @@ fn main() {
|
||||||
.unwrap_or_else(|err: Traceback| eprintln!("failed to load script {}\n{}", cfg_file, err));
|
.unwrap_or_else(|err: Traceback| eprintln!("failed to load script {}\n{}", cfg_file, err));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature="posix")]
|
|
||||||
let prompt_ss: Rc<RefCell<ShellState>>;
|
|
||||||
#[cfg(feature="posix")]
|
#[cfg(feature="posix")]
|
||||||
{
|
{
|
||||||
let shell_state_bindings = Rc::new(RefCell::from(ShellState {
|
dynamic_stdlib(&mut syms, Some(prompt_ss.clone()));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup readline
|
// setup readline
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue