utils/github/api: Fix uninitialized constant Etc

- I saw this in:

```
Error: uninitialized constant GitHub::API::Etc
Warning: Removed Sorbet lines from backtrace!
Rerun with `--verbose` to see the original backtrace
/opt/homebrew/Library/Homebrew/utils/github/api.rb:140:in `uid_home'
/opt/homebrew/Library/Homebrew/utils/github/api.rb:154:in `block in github_cli_token'
/opt/homebrew/Library/Homebrew/utils/uid.rb:8:in `drop_euid'
/opt/homebrew/Library/Homebrew/utils/github/api.rb:150:in `github_cli_token'
/opt/homebrew/Library/Homebrew/utils/github/api.rb:194:in `credentials'
/opt/homebrew/Library/Homebrew/utils/github/api.rb:251:in `open_rest'
/opt/homebrew/Library/Homebrew/utils/github/api.rb:334:in `open_graphql'
/opt/homebrew/Library/Homebrew/utils/github.rb:414:in `members_by_team'
/opt/homebrew/Library/Homebrew/dev-cmd/contributions.rb:71:in `run'
/opt/homebrew/Library/Homebrew/brew.rb:95:in `<main>'
```
This commit is contained in:
Issy Long 2024-07-27 23:43:28 +01:00
parent 99e2d93ea5
commit 0af1ce866c
No known key found for this signature in database

View File

@ -137,6 +137,7 @@ module GitHub
sig { returns(T.nilable(String)) }
private_class_method def self.uid_home
require "etc"
Etc.getpwuid(Process.uid)&.dir
rescue ArgumentError
# Cover for misconfigured NSS setups