diff --git a/src/run.rs b/src/run.rs index 6c6a5e1ce2..58986ba89b 100644 --- a/src/run.rs +++ b/src/run.rs @@ -35,6 +35,7 @@ pub(crate) fn run_commands( parsed_nu_cli_args.plugin_file, NUSHELL_FOLDER, ); + perf( "read plugins", start_time, @@ -45,8 +46,8 @@ pub(crate) fn run_commands( ); let start_time = std::time::Instant::now(); - // only want to load config and env if relative argument is provided. - if parsed_nu_cli_args.env_file.is_some() { + // If we have a env file parameter *OR* we have a login shell parameter, read the env file + if parsed_nu_cli_args.env_file.is_some() || parsed_nu_cli_args.login_shell.is_some() { config_files::read_config_file( engine_state, &mut stack, @@ -56,6 +57,7 @@ pub(crate) fn run_commands( } else { config_files::read_default_env_file(engine_state, &mut stack) } + perf( "read env.nu", start_time, @@ -66,7 +68,8 @@ pub(crate) fn run_commands( ); let start_time = std::time::Instant::now(); - if parsed_nu_cli_args.config_file.is_some() { + // If we have a config file parameter *OR* we have a login shell parameter, read the config file + if parsed_nu_cli_args.config_file.is_some() || parsed_nu_cli_args.login_shell.is_some() { config_files::read_config_file( engine_state, &mut stack, @@ -74,6 +77,7 @@ pub(crate) fn run_commands( false, ); } + perf( "read config.nu", start_time, @@ -82,6 +86,21 @@ pub(crate) fn run_commands( column!(), use_color, ); + + // If we have a login shell parameter, read the login file + let start_time = std::time::Instant::now(); + if parsed_nu_cli_args.login_shell.is_some() { + config_files::read_loginshell_file(engine_state, &mut stack); + } + + perf( + "read login.nu", + start_time, + file!(), + line!(), + column!(), + use_color, + ); } // Before running commands, set up the startup time