mirror of
https://github.com/nushell/nushell
synced 2025-01-26 03:45:19 +00:00
Revert "Remove no-longer-needed convert_env_values calls (#14681)"
This reverts commit 0d3f76ddef
.
This commit is contained in:
parent
b60f91f722
commit
11389cded2
3 changed files with 36 additions and 2 deletions
|
@ -19,7 +19,7 @@ use miette::{ErrReport, IntoDiagnostic, Result};
|
|||
use nu_cmd_base::util::get_editor;
|
||||
use nu_color_config::StyleComputer;
|
||||
#[allow(deprecated)]
|
||||
use nu_engine::{current_dir_str, env_to_strings};
|
||||
use nu_engine::{convert_env_values, current_dir_str, env_to_strings};
|
||||
use nu_parser::{lex, parse, trim_quotes_str};
|
||||
use nu_protocol::{
|
||||
config::NuCursorShape,
|
||||
|
@ -79,6 +79,13 @@ pub fn evaluate_repl(
|
|||
stack.clone(),
|
||||
);
|
||||
|
||||
let start_time = std::time::Instant::now();
|
||||
// Translate environment variables from Strings to Values
|
||||
if let Err(e) = convert_env_values(engine_state, &unique_stack) {
|
||||
report_shell_error(engine_state, &e);
|
||||
}
|
||||
perf!("translate env vars", start_time, use_color);
|
||||
|
||||
// seed env vars
|
||||
unique_stack.add_env_var(
|
||||
"CMD_DURATION_MS".into(),
|
||||
|
|
|
@ -89,7 +89,22 @@ pub fn convert_env_values(engine_state: &mut EngineState, stack: &Stack) -> Resu
|
|||
}
|
||||
}
|
||||
|
||||
error = error.or_else(|| ensure_path(&mut new_scope, "PATH"));
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
error = error.or_else(|| ensure_path(&mut new_scope, "PATH"));
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let first_result = ensure_path(&mut new_scope, "Path");
|
||||
if first_result.is_some() {
|
||||
let second_result = ensure_path(&mut new_scope, "PATH");
|
||||
|
||||
if second_result.is_some() {
|
||||
error = error.or(first_result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Ok(last_overlay_name) = &stack.last_overlay_name() {
|
||||
if let Some(env_vars) = Arc::make_mut(&mut engine_state.env_vars).get_mut(last_overlay_name)
|
||||
|
|
|
@ -52,6 +52,18 @@ pub(crate) fn read_config_file(
|
|||
use_color
|
||||
);
|
||||
} else {
|
||||
let start_time = std::time::Instant::now();
|
||||
let config = engine_state.get_config();
|
||||
let use_color = config.use_ansi_coloring.get(engine_state);
|
||||
if let Err(e) = convert_env_values(engine_state, stack) {
|
||||
report_shell_error(engine_state, &e);
|
||||
}
|
||||
perf!(
|
||||
"translate env vars before default_config.nu",
|
||||
start_time,
|
||||
use_color
|
||||
);
|
||||
|
||||
eval_default_config(engine_state, stack, get_default_config(), is_env_config);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue