kill -INT not kiling process on linux. switched to kill -KILL

This commit is contained in:
Sidney Burks 2011-06-20 02:42:03 +02:00
parent 39c964a968
commit d795068894

View File

@ -21,7 +21,7 @@ module Guard
def stop def stop
if File.file?(pid_file) if File.file?(pid_file)
system %{kill -INT #{File.read(pid_file).strip}} system %{kill -KILL #{File.read(pid_file).strip}}
end end
end end
@ -69,18 +69,23 @@ module Guard
def kill_unmanaged_pid! def kill_unmanaged_pid!
if pid = unmanaged_pid if pid = unmanaged_pid
system %{kill -INT #{pid}} system %{kill -KILL #{pid}}
end end
end end
def unmanaged_pid def unmanaged_pid
if RbConfig::CONFIG['host_os'] =~ /darwin/ pid_command =
%x{lsof -P}.each_line { |line| case RbConfig::CONFIG['host_os']
if line["*:#{options[:port]} "] when /darwin/i
return line.split("\s")[1] 'lsof -P'
end when /linux/i
} "lsof -i :#{options[:port]}"
end end
%x{#{pid_command}}.each_line { |line|
if line["*:#{options[:port]} "]
return line.split("\s")[1]
end
}
nil nil
end end
end end