aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorTrevor Powell2017-01-30 22:31:09 -0600
committerGitHub2017-01-30 22:31:09 -0600
commite11b8b68cdf2b021dce4a11c40afddc306dab7d4 (patch)
tree9c002711a143cf79c9f154a52f71cb0b86f1261b /Library
parent4ce6616f2eff36afb7ed3effc35f7ee0c108e266 (diff)
downloadbrew-e11b8b68cdf2b021dce4a11c40afddc306dab7d4.tar.bz2
Update dmg.rb based on feedback
Try "diskutil eject" twice before "diskutil unmount force".
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/dmg.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/container/dmg.rb b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
index 49543844a..815f8f010 100644
--- a/Library/Homebrew/cask/lib/hbc/container/dmg.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
@@ -43,12 +43,17 @@ module Hbc
next unless mountpath.exist?
begin
- tries ||= 2
- @command.run("/usr/sbin/diskutil",
- args: ["unmount", "force", mountpath],
- print_stderr: false)
-
- raise CaskError, "Failed to unmount #{mountpath}" if mountpath.exist?
+ 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?
sleep 1