Skip to content

Commit

Permalink
sorbet: set utils/user.rb to true
Browse files Browse the repository at this point in the history
  • Loading branch information
vidusheeamoli committed Jul 10, 2020
1 parent 82e23c3 commit 9799f32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/sorbet/files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ false:
- ./utils/git.rb
- ./utils/github.rb
- ./utils/popen.rb
- ./utils/user.rb

false:
- ./PATH.rb
Expand Down Expand Up @@ -895,6 +894,7 @@ true:
- ./utils/shell.rb
- ./utils/svn.rb
- ./utils/tty.rb
- ./utils/user.rb
- ./version/null.rb

strict:
Expand Down
9 changes: 9 additions & 0 deletions Library/Homebrew/sorbet/rbi/utils/user.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# typed: strict

class User < String
def gui?
end

def self.current
end
end
7 changes: 6 additions & 1 deletion Library/Homebrew/utils/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def gui?
end

def self.current
@current ||= new(Etc.getpwuid(Process.euid).name)
return @current if defined?(@current)

pwuid = Etc.getpwuid(Process.euid)
return if pwuid.nil?

@current = new(pwuid.name)
end
end

0 comments on commit 9799f32

Please sign in to comment.