From d93953a56f12ec30d06bc44da388f30d22415c91 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Thu, 6 Apr 2023 20:21:33 +0200 Subject: [PATCH] FIX: load the library before anything else (#8774) --- src/run.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/run.rs b/src/run.rs index a20a73095..fb6eb0827 100644 --- a/src/run.rs +++ b/src/run.rs @@ -113,6 +113,9 @@ pub(crate) fn run_commands( ) -> Result<(), miette::ErrReport> { let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); + + load_standard_library(engine_state)?; + #[cfg(feature = "plugin")] read_plugin_file( engine_state, @@ -163,8 +166,6 @@ pub(crate) fn run_commands( use_color, ); - load_standard_library(engine_state)?; - // Before running commands, set up the startup time engine_state.set_startup_time(entire_start_time.elapsed().as_nanos() as i64); let start_time = std::time::Instant::now(); @@ -202,6 +203,8 @@ pub(crate) fn run_file( let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); + load_standard_library(engine_state)?; + #[cfg(feature = "plugin")] read_plugin_file( engine_state, @@ -252,8 +255,6 @@ pub(crate) fn run_file( use_color, ); - load_standard_library(engine_state)?; - let start_time = std::time::Instant::now(); let ret_val = evaluate_file( script_name, @@ -301,6 +302,8 @@ pub(crate) fn run_repl( let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); + load_standard_library(engine_state)?; + if parsed_nu_cli_args.no_config_file.is_none() { setup_config( engine_state, @@ -324,8 +327,6 @@ pub(crate) fn run_repl( use_color, ); - load_standard_library(engine_state)?; - let start_time = std::time::Instant::now(); let ret_val = evaluate_repl( engine_state,