mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Run ENV_CONVERSIONS whenever it's modified (#14591)
- this PR should close #14514 # Description Makes updates to `$env.ENV_CONVERSIONS` take effect immediately. # User-Facing Changes No breaking change, `$env.ENV_CONVERSIONS` can be set and its effect used in the same file. # Tests + Formatting - 🟢 toolkit fmt - 🟢 toolkit clippy - 🟢 toolkit test - 🟢 toolkit test stdlib # After Submitting N/A
This commit is contained in:
@ -14,7 +14,9 @@ use nu_protocol::{
|
||||
};
|
||||
use nu_utils::IgnoreCaseExt;
|
||||
|
||||
use crate::{eval::is_automatic_env_var, eval_block_with_early_return};
|
||||
use crate::{
|
||||
convert_env_vars, eval::is_automatic_env_var, eval_block_with_early_return, ENV_CONVERSIONS,
|
||||
};
|
||||
|
||||
/// Evaluate the compiled representation of a [`Block`].
|
||||
pub fn eval_ir_block<D: DebugContext>(
|
||||
@ -384,10 +386,16 @@ fn eval_instruction<D: DebugContext>(
|
||||
|
||||
if !is_automatic_env_var(&key) {
|
||||
let is_config = key == "config";
|
||||
ctx.stack.add_env_var(key.into_owned(), value);
|
||||
let update_conversions = key == ENV_CONVERSIONS;
|
||||
|
||||
ctx.stack.add_env_var(key.into_owned(), value.clone());
|
||||
|
||||
if is_config {
|
||||
ctx.stack.update_config(ctx.engine_state)?;
|
||||
}
|
||||
if update_conversions {
|
||||
convert_env_vars(ctx.stack, ctx.engine_state, &value)?;
|
||||
}
|
||||
Ok(Continue)
|
||||
} else {
|
||||
Err(ShellError::AutomaticEnvVarSetManually {
|
||||
|
Reference in New Issue
Block a user