Class: Killrails::Kill
- Inherits:
-
Object
- Object
- Killrails::Kill
- Defined in:
- lib/killrails.rb
Instance Method Summary collapse
-
#initialize(port) ⇒ Kill
constructor
A new instance of Kill.
- #kill_process ⇒ Object
Constructor Details
#initialize(port) ⇒ Kill
Returns a new instance of Kill.
5 6 7 |
# File 'lib/killrails.rb', line 5 def initialize(port) @port = port.to_i end |
Instance Method Details
#kill_process ⇒ Object
9 10 11 12 13 14 15 16 |
# 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 |