class Killrails::Kill

Public Class Methods

new(port) click to toggle source
# File lib/killrails.rb, line 5
def initialize(port)
  @port = port.to_i
end

Public Instance Methods

kill_process() click to toggle source
# File lib/killrails.rb, line 9
def kill_process 
  system("kill -15 $(lsof -t -wni tcp:#@port) >/dev/null 2>&1")
  if $? == 0
    puts "Rails server on port #@port killed"
  else 
    puts "Port is not valid or server process is not running"
  end
end