utils/gems: handle mismatching EUID and UID for bundle installs

This commit is contained in:
Bo Anderson 2024-05-01 14:28:16 +01:00
parent a5a915043b
commit 1e7cf514eb
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -32,7 +32,6 @@ module Homebrew
Homebrew.forget_user_gem_groups!
end
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
Homebrew.install_bundler_gems!(groups:)
end
end

View File

@ -300,7 +300,12 @@ module Homebrew
end
bundle_installed = if bundle_install_required
if system bundle, "install", out: :err
Process.wait(fork do
# Native build scripts fail if EUID != UID
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
exec bundle, "install", out: :err
end)
if $CHILD_STATUS.success?
true
else
message = <<~EOS