diff --git a/e2e/cd/test_bash b/e2e/cd/test_bash index 60b827f76..131c2ab28 100755 --- a/e2e/cd/test_bash +++ b/e2e/cd/test_bash @@ -2,6 +2,7 @@ # shellcheck disable=SC2088 set -euo pipefail +export RTX_EXPERIMENTAL=1 orig_path="$PATH" # shellcheck disable=SC1090 diff --git a/src/cli/hook_env.rs b/src/cli/hook_env.rs index defd7bc36..7df80c107 100644 --- a/src/cli/hook_env.rs +++ b/src/cli/hook_env.rs @@ -10,6 +10,7 @@ use terminal_size::{terminal_size, Width}; use crate::config::Config; +use crate::config::Settings; use crate::direnv::DirenvDiff; use crate::env::__RTX_DIFF; use crate::env_diff::{EnvDiff, EnvDiffOperation}; @@ -48,7 +49,7 @@ impl HookEnv { paths.extend(ts.list_paths(&config)); // load the active runtime paths diff.path = paths.clone(); // update __RTX_DIFF with the new paths for the next run - patches.extend(self.build_path_operations(&paths, &__RTX_DIFF.path)?); + patches.extend(self.build_path_operations(&config.settings, &paths, &__RTX_DIFF.path)?); patches.push(self.build_diff_operation(&diff)?); patches.push(self.build_watch_operation(&config)?); @@ -87,14 +88,17 @@ impl HookEnv { /// modifies the PATH and optionally DIRENV_DIFF env var if it exists fn build_path_operations( &self, + settings: &Settings, installs: &Vec, to_remove: &Vec, ) -> Result> { let full = join_paths(&*env::PATH)?.to_string_lossy().to_string(); let (pre, post) = match &*env::__RTX_ORIG_PATH { Some(orig_path) => match full.split_once(&format!(":{orig_path}")) { - Some((pre, post)) => (pre.to_string(), (orig_path.to_string() + post)), - None => (String::new(), full), + Some((pre, post)) if settings.experimental => { + (pre.to_string(), (orig_path.to_string() + post)) + } + _ => (String::new(), full), }, None => (String::new(), full), };