Module: Utils::UID Private
- Defined in:
- utils/uid.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Class Method Summary collapse
- .drop_euid(&_block) ⇒ T.type_parameter(:U) private
- .uid_home ⇒ String? private
Class Method Details
.drop_euid(&_block) ⇒ T.type_parameter(:U)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'utils/uid.rb', line 7 def self.drop_euid(&_block) return yield if Process.euid == Process.uid original_euid = Process.euid begin Process::Sys.seteuid(Process.uid) yield ensure Process::Sys.seteuid(original_euid) end end |
.uid_home ⇒ String?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
20 21 22 23 24 25 26 |
# File 'utils/uid.rb', line 20 def self.uid_home require "etc" Etc.getpwuid(Process.uid)&.dir rescue ArgumentError # Cover for misconfigured NSS setups nil end |