From 43be5bd7da35dd9a4139e9ba176c191c8635d83e Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Sat, 1 Aug 2020 15:13:04 +0300 Subject: [PATCH] Don't pass --user-install if ruby is managed by rbenv (fix #393) (#489) --- src/steps/generic.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 203f40be..199cb277 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -50,7 +50,15 @@ pub fn run_gem(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> { print_separator("RubyGems"); - run_type.execute(&gem).args(&["update", "--user-install"]).check_run() + let mut command = run_type.execute(&gem); + command.arg("update"); + + if env::var_os("RBENV_SHELL").is_none() { + debug!("Detected rbenv. Avoiding --user-install"); + command.arg("--user-install"); + } + + command.check_run() } pub fn run_sheldon(ctx: &ExecutionContext) -> Result<()> {