diff --git a/lib/vagrant-lxc/action/clear_forwarded_ports.rb b/lib/vagrant-lxc/action/clear_forwarded_ports.rb index 44c0586..8f66963 100644 --- a/lib/vagrant-lxc/action/clear_forwarded_ports.rb +++ b/lib/vagrant-lxc/action/clear_forwarded_ports.rb @@ -15,7 +15,7 @@ module Vagrant redir_pids.each do |pid| next unless is_redir_pid?(pid) @logger.debug "Killing pid #{pid}" - system "sudo pkill -9 -P #{pid}" + system "sudo pkill -TERM -P #{pid}" end remove_redir_pids diff --git a/spec/unit/action/clear_forwarded_ports_spec.rb b/spec/unit/action/clear_forwarded_ports_spec.rb index 4dcc997..c111032 100644 --- a/spec/unit/action/clear_forwarded_ports_spec.rb +++ b/spec/unit/action/clear_forwarded_ports_spec.rb @@ -28,15 +28,15 @@ describe Vagrant::LXC::Action::ClearForwardedPorts do context 'with a valid redir pid' do it 'kills known processes' do - subject.should have_received(:system).with("sudo pkill -9 -P #{pid}") + subject.should have_received(:system).with("sudo pkill -TERM -P #{pid}") end end context 'with an invalid pid' do - let(:pid_cmd) { 'sudo ls' } + let(:pid_cmd) { 'sudo ls' } it 'does not kill the process' do - subject.should_not have_received(:system).with("sudo pkill -9 -P #{pid}") + subject.should_not have_received(:system).with("sudo pkill -TERM -P #{pid}") end end end