diff options
| author | Markus Reiter | 2017-02-16 21:53:22 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-16 22:00:01 +0100 |
| commit | fcd88b71f5eb0d9915264473dd0c155003563f89 (patch) | |
| tree | 8a74648083ddc0bda68e648d26a34fa944edf906 | |
| parent | f4965685ba015f9078f75722d8368649c9624462 (diff) | |
| download | brew-fcd88b71f5eb0d9915264473dd0c155003563f89.tar.bz2 | |
Allow skipping `uninstall script:` when `--force` is passed.
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb | 10 |
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 |
