From d795068894467e5040c88a211499c4bc8c6a6afc Mon Sep 17 00:00:00 2001 From: Sidney Burks Date: Mon, 20 Jun 2011 02:42:03 +0200 Subject: [PATCH] kill -INT not kiling process on linux. switched to kill -KILL --- lib/guard/rails/runner.rb | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/guard/rails/runner.rb b/lib/guard/rails/runner.rb index 1a9a37c..27bcc78 100644 --- a/lib/guard/rails/runner.rb +++ b/lib/guard/rails/runner.rb @@ -21,7 +21,7 @@ module Guard def stop if File.file?(pid_file) - system %{kill -INT #{File.read(pid_file).strip}} + system %{kill -KILL #{File.read(pid_file).strip}} end end @@ -69,18 +69,23 @@ module Guard def kill_unmanaged_pid! if pid = unmanaged_pid - system %{kill -INT #{pid}} + system %{kill -KILL #{pid}} end end def unmanaged_pid - if RbConfig::CONFIG['host_os'] =~ /darwin/ - %x{lsof -P}.each_line { |line| - if line["*:#{options[:port]} "] - return line.split("\s")[1] - end - } - end + pid_command = + case RbConfig::CONFIG['host_os'] + when /darwin/i + 'lsof -P' + when /linux/i + "lsof -i :#{options[:port]}" + end + %x{#{pid_command}}.each_line { |line| + if line["*:#{options[:port]} "] + return line.split("\s")[1] + end + } nil end end