don't check error code of `diskutil eject`
nstead, determine success by directly testing the intended effect: does the mount path still exist? Also: - retry once on failure. - silent success if the given mount point did not exist. These changes are intended to help with unpredictable problems with the test suite that manifest frequently on Travis. References: #4975, #4900, #4857
This commit is contained in:
parent
d3278a5d41
commit
06c9bae613
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue