Skip to content

Commit 4c14853

Browse files
committed
Don't update the user's shell config files if VOLTA_HOME and PATH already contain what we need.
1 parent ab1b36d commit 4c14853

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/command/setup.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ mod os {
4343
let home = volta_home()?;
4444
let formatted_home = format_home(home.root());
4545

46+
// Don't update the user's shell config files if VOLTA_HOME and PATH already contain what we need.
47+
let home_in_path = match env::var_os("PATH") {
48+
Some(paths) => env::split_paths(&paths).find(|p| p == home.root()),
49+
None => None
50+
};
51+
52+
if env::var_os("VOLTA_HOME").is_some() && home_in_path.is_some() {
53+
return Ok(());
54+
}
55+
4656
debug!("Searching for profiles to update");
4757
let profiles = determine_profiles()?;
4858

0 commit comments

Comments
 (0)