From 2807f88212827d3388be4f11865d1d0e8421d372 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Tue, 23 Apr 2013 07:55:37 -0300 Subject: [PATCH] Properly kill `redir` child processes Fixes #59 --- lib/vagrant-lxc/action/clear_forwarded_ports.rb | 2 +- spec/unit/action/clear_forwarded_ports_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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