Merge pull request #4978 from rolandwalker/eject_error_code

don't check error code of diskutil eject
This commit is contained in:
Roland Walker
2014-06-19 12:04:46 -04:00
+12 -1
View File
@@ -45,7 +45,18 @@ class Cask::Container::Dmg < Cask::Container::Base
def eject!
@mounts.each do |mount|
# realpath is a failsafe against unusual filenames
@command.run!('/usr/sbin/diskutil', :args => ['eject', Pathname.new(mount).realpath])
mountpath = Pathname.new(mount).realpath
next unless mountpath.exist?
@command.run('/usr/sbin/diskutil',
:args => ['eject', mountpath],
:stderr => :silence)
next unless mountpath.exist?
sleep 1
@command.run('/usr/sbin/diskutil',
:args => ['eject', mountpath],
:stderr => :silence)
next unless mountpath.exist?
raise CaskError.new "Failed to eject #{mountpath}"
end
end
end