From 2f05b4724247cf13368e452f6b0400a563151fe5 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Thu, 28 Mar 2024 15:39:07 +0000 Subject: [PATCH] Fix setup-ruby/rubocop issues when euid != uid --- Library/Homebrew/cmd/setup-ruby.sh | 3 ++- Library/Homebrew/dev-cmd/rubocop.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/setup-ruby.sh b/Library/Homebrew/cmd/setup-ruby.sh index 5ddab3c465466..d677899dfd2b3 100644 --- a/Library/Homebrew/cmd/setup-ruby.sh +++ b/Library/Homebrew/cmd/setup-ruby.sh @@ -17,7 +17,8 @@ homebrew-setup-ruby() { return fi - GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')" + GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_DISABLE_OPTIONS}" /dev/stdin <<<'require "rbconfig"; puts RbConfig::CONFIG["ruby_version"]')" + echo "${GEM_VERSION}" GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}" BUNDLE_GEMFILE="${HOMEBREW_LIBRARY}/Homebrew/Gemfile" diff --git a/Library/Homebrew/dev-cmd/rubocop.sh b/Library/Homebrew/dev-cmd/rubocop.sh index 38edae11b30d9..db26803b15bed 100644 --- a/Library/Homebrew/dev-cmd/rubocop.sh +++ b/Library/Homebrew/dev-cmd/rubocop.sh @@ -11,7 +11,7 @@ homebrew-rubocop() { source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh" setup-ruby-path - GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')" + GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_DISABLE_OPTIONS}" /dev/stdin <<<'require "rbconfig"; puts RbConfig::CONFIG["ruby_version"]')" GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}" BUNDLE_GEMFILE="${HOMEBREW_LIBRARY}/Homebrew/Gemfile" BUNDLE_WITH="style"