From 89f4d153a22cde0fe7903713bcfe42426977274b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 17 Feb 2017 04:01:50 +0100 Subject: [PATCH] =?UTF-8?q?Only=20show=20=E2=80=9Csudo=E2=80=9D=20message?= =?UTF-8?q?=20when=20it=20is=20actually=20needed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Homebrew/cask/lib/hbc/caskroom.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/caskroom.rb b/Library/Homebrew/cask/lib/hbc/caskroom.rb index 644728129e..255e23888a 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)