aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-17 04:01:50 +0100
committerMarkus Reiter2017-02-17 04:01:50 +0100
commit89f4d153a22cde0fe7903713bcfe42426977274b (patch)
treed25be18eb62f3990dacdb4ea350c2efea61dd0fa /Library/Homebrew/cask/lib
parentf4965685ba015f9078f75722d8368649c9624462 (diff)
downloadbrew-89f4d153a22cde0fe7903713bcfe42426977274b.tar.bz2
Only show “sudo” message when it is actually needed.
Diffstat (limited to 'Library/Homebrew/cask/lib')
-rw-r--r--Library/Homebrew/cask/lib/hbc/caskroom.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/caskroom.rb b/Library/Homebrew/cask/lib/hbc/caskroom.rb
index 644728129..255e23888 100644
--- a/Library/Homebrew/cask/lib/hbc/caskroom.rb
+++ b/Library/Homebrew/cask/lib/hbc/caskroom.rb
@@ -21,9 +21,10 @@ module Hbc
return if Hbc.caskroom.exist?
ohai "Creating Caskroom at #{Hbc.caskroom}"
- ohai "We'll set permissions properly so we won't need sudo in the future"
sudo = !Hbc.caskroom.parent.writable?
+ ohai "We'll set permissions properly so we won't need sudo in the future" if sudo
+
SystemCommand.run("/bin/mkdir", args: ["-p", Hbc.caskroom], sudo: sudo)
SystemCommand.run("/bin/chmod", args: ["g+rwx", Hbc.caskroom], sudo: sudo)
SystemCommand.run("/usr/sbin/chown", args: [Utils.current_user, Hbc.caskroom], sudo: sudo)