Skip to content

Commit

Permalink
kill -INT not kiling process on linux. switched to kill -KILL
Browse files Browse the repository at this point in the history
  • Loading branch information
sid137 committed Jun 20, 2011
1 parent 39c964a commit d795068
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/guard/rails/runner.rb
Expand Up @@ -21,7 +21,7 @@ def start

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

Expand Down Expand Up @@ -69,18 +69,23 @@ def wait_for_pid_action

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
Expand Down

0 comments on commit d795068

Please sign in to comment.