diff options
| author | Markus Reiter | 2017-02-03 11:45:18 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-03 11:45:18 +0100 |
| commit | 01c13720749d9c4d0050a5bca943543d5bd8a9de (patch) | |
| tree | 09bd8ebfb10ef19d9330ef120cca746d22229551 /Library | |
| parent | 04637e8d370407865991d59898c2209326a01664 (diff) | |
| parent | e11b8b68cdf2b021dce4a11c40afddc306dab7d4 (diff) | |
| download | brew-01c13720749d9c4d0050a5bca943543d5bd8a9de.tar.bz2 | |
Merge pull request #1897 from trevorpowell/master
Proposed fix for "Failed to eject" errors with DMGs
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/dmg.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/container/dmg.rb b/Library/Homebrew/cask/lib/hbc/container/dmg.rb index 987455ad7..815f8f010 100644 --- a/Library/Homebrew/cask/lib/hbc/container/dmg.rb +++ b/Library/Homebrew/cask/lib/hbc/container/dmg.rb @@ -43,11 +43,16 @@ module Hbc next unless mountpath.exist? begin - tries ||= 2 - @command.run("/usr/sbin/diskutil", - args: ["eject", mountpath], - print_stderr: false) - + tries ||= 3 + if tries > 1 + @command.run("/usr/sbin/diskutil", + args: ["eject", mountpath], + print_stderr: false) + else + @command.run("/usr/sbin/diskutil", + args: ["unmount", "force", mountpath], + print_stderr: false) + end raise CaskError, "Failed to eject #{mountpath}" if mountpath.exist? rescue CaskError => e raise e if (tries -= 1).zero? |
