more reliable way to look up username
`ENV` is manipulable. `getpwuid` is reliable.
This commit is contained in:
parent
1fe35b95f5
commit
3ded5898b6
|
@ -47,7 +47,7 @@ class Cask
|
||||||
unless caskroom.exist?
|
unless caskroom.exist?
|
||||||
ohai "We need to make Caskroom for the first time at #{caskroom}"
|
ohai "We need to make Caskroom for the first time at #{caskroom}"
|
||||||
ohai "We'll set permissions properly so we won't need sudo in the future"
|
ohai "We'll set permissions properly so we won't need sudo in the future"
|
||||||
current_user = ENV['USER']
|
current_user = Etc.getpwuid(Process.euid).name
|
||||||
if caskroom.parent.writable?
|
if caskroom.parent.writable?
|
||||||
system '/bin/mkdir', caskroom
|
system '/bin/mkdir', caskroom
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue