aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
index ce2b1f51a..cc47e05ad 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
@@ -201,7 +201,15 @@ module Hbc
ohai "Running uninstall script #{executable}"
raise CaskInvalidError.new(@cask, "#{stanza} :#{directive_name} without :executable.") if executable.nil?
executable_path = @cask.staged_path.join(executable)
- @command.run("/bin/chmod", args: ["--", "+x", executable_path]) if File.exist?(executable_path)
+
+ unless executable_path.exist?
+ message = "uninstall script #{executable} does not exist"
+ raise CaskError, "#{message}." unless force
+ opoo "#{message}, skipping."
+ return
+ end
+
+ @command.run("/bin/chmod", args: ["--", "+x", executable_path])
@command.run(executable_path, script_arguments)
sleep 1
end