From 920e0acb85bc615c61b2ce6144ff56a1915cfe13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1dn=C3=ADk?= Date: Sun, 10 Jul 2022 18:12:24 +0300 Subject: [PATCH] Fix load order of config files (#6006) --- src/main.rs | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/main.rs b/src/main.rs index e063b813cb..0733ff14a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -205,16 +205,8 @@ fn main() -> Result<()> { NUSHELL_FOLDER, is_perf_true(), ); + // only want to load config and env if relative argument is provided. - if binary_args.config_file.is_some() { - config_files::read_config_file( - &mut engine_state, - &mut stack, - binary_args.config_file, - is_perf_true(), - false, - ); - } if binary_args.env_file.is_some() { config_files::read_config_file( &mut engine_state, @@ -225,6 +217,16 @@ fn main() -> Result<()> { ); } + if binary_args.config_file.is_some() { + config_files::read_config_file( + &mut engine_state, + &mut stack, + binary_args.config_file, + is_perf_true(), + false, + ); + } + let ret_val = evaluate_commands( commands, &init_cwd, @@ -250,16 +252,8 @@ fn main() -> Result<()> { NUSHELL_FOLDER, is_perf_true(), ); + // only want to load config and env if relative argument is provided. - if binary_args.config_file.is_some() { - config_files::read_config_file( - &mut engine_state, - &mut stack, - binary_args.config_file, - is_perf_true(), - false, - ); - } if binary_args.env_file.is_some() { config_files::read_config_file( &mut engine_state, @@ -270,6 +264,16 @@ fn main() -> Result<()> { ); } + if binary_args.config_file.is_some() { + config_files::read_config_file( + &mut engine_state, + &mut stack, + binary_args.config_file, + is_perf_true(), + false, + ); + } + let ret_val = evaluate_file( script_name, &args_to_script,