Check for external exceptions more often (#4628)

This commit is contained in:
JT 2022-02-24 10:31:24 -05:00 committed by GitHub
parent 308ab91aff
commit c984ce9dc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View File

@ -19,6 +19,10 @@ pub(crate) fn evaluate(
// First, set up env vars as strings only
gather_parent_env_vars(engine_state);
// Make a note of the exceptions we see for externals that look like math expressions
let exceptions = crate::utils::external_exceptions();
engine_state.external_exceptions = exceptions;
// Run a command (or commands) given to us by the user
let (block, delta) = {
let mut working_set = StateWorkingSet::new(engine_state);

View File

@ -22,6 +22,10 @@ pub(crate) fn evaluate(
// First, set up env vars as strings only
gather_parent_env_vars(engine_state);
// Make a note of the exceptions we see for externals that look like math expressions
let exceptions = crate::utils::external_exceptions();
engine_state.external_exceptions = exceptions;
let mut stack = nu_protocol::engine::Stack::new();
// Set up our initial config to start from

View File

@ -57,10 +57,6 @@ fn main() -> Result<()> {
};
let _ = engine_state.merge_delta(delta, None, &init_cwd);
// Make a note of the exceptions we see for externals that look like math expressions
let exceptions = crate::utils::external_exceptions();
engine_state.external_exceptions = exceptions;
// TODO: make this conditional in the future
// Ctrl-c protection section
let ctrlc = Arc::new(AtomicBool::new(false));

View File

@ -35,6 +35,10 @@ pub(crate) fn evaluate(
// First, set up env vars as strings only
gather_parent_env_vars(engine_state);
// Make a note of the exceptions we see for externals that look like math expressions
let exceptions = crate::utils::external_exceptions();
engine_state.external_exceptions = exceptions;
// Set up our initial config to start from
stack.vars.insert(
CONFIG_VARIABLE_ID,
@ -316,6 +320,10 @@ pub(crate) fn evaluate(
let _ = std::env::set_current_dir(path);
engine_state.env_vars.insert("PWD".into(), cwd);
}
// Make a note of the exceptions we see for externals that look like math expressions
let exceptions = crate::utils::external_exceptions();
engine_state.external_exceptions = exceptions;
}
Ok(Signal::CtrlC) => {
// `Reedline` clears the line content. New prompt is shown