aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-17 01:10:32 +0100
committerGitHub2017-02-17 01:10:32 +0100
commit18838109b76ddc2b4aa958a3e8fd9adfbd083c62 (patch)
treef98f6cce11dcf8623d8134cfe379d80b6bda836f /Library/Homebrew/cask/lib
parentf4965685ba015f9078f75722d8368649c9624462 (diff)
parentb51161b08b3e3b26d279952a34e9e54da4a059f0 (diff)
downloadbrew-18838109b76ddc2b4aa958a3e8fd9adfbd083c62.tar.bz2
Merge pull request #2038 from reitermarkus/non-existant-uninstall-script
Allow skipping `uninstall script:` when `--force` is passed.
Diffstat (limited to 'Library/Homebrew/cask/lib')
-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