Merge pull request #1897 from trevorpowell/master

Proposed fix for "Failed to eject" errors with DMGs
This commit is contained in:
Markus Reiter 2017-02-03 11:45:18 +01:00 committed by GitHub
commit 01c1372074

View File

@ -43,11 +43,16 @@ module Hbc
next unless mountpath.exist?
begin
tries ||= 2
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?