Merge pull request #3515 from rolandwalker/unload_service

explicitly unload :launchctl service before remove
This commit is contained in:
Roland Walker 2014-03-14 21:12:14 -04:00
commit be255dcdbc
2 changed files with 3 additions and 0 deletions

View File

@ -104,6 +104,8 @@ class Cask::Artifact::Pkg < Cask::Artifact::Base
[false, true].each do |with_sudo|
xml_status = @command.run('/bin/launchctl', :args => ['list', '-x', service], :sudo => with_sudo)
if %r{^<\?xml}.match(xml_status)
@command.run('/bin/launchctl', :args => ['unload', '-w', '--', service], :sudo => with_sudo)
sleep 1
@command.run!('/bin/launchctl', :args => ['remove', '--', service], :sudo => with_sudo)
sleep 1
end

View File

@ -108,6 +108,7 @@ describe Cask::Artifact::Pkg do
)
Cask::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/launchctl', 'remove', '--', 'my.fancy.package.service'])
Cask::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/launchctl', 'unload', '-w', '--', 'my.fancy.package.service'])
Cask::FakeSystemCommand.stubs_command(['/usr/bin/sudo', '-E', '--', '/usr/sbin/kextstat', '-l', '-b', 'my.fancy.package.kernelextension'], 'loaded')
Cask::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/sbin/kextunload', '-b', '--', 'my.fancy.package.kernelextension'])