Properly kill redir child processes

Fixes #59
This commit is contained in:
Fabio Rehm 2013-04-23 07:55:37 -03:00
parent 21c998f7f1
commit 2807f88212
2 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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