Added ability to kill process found on port
parent
afbe72fa42
commit
678a3c39f8
@ -0,0 +1,13 @@
|
|||||||
|
module CommandRunner
|
||||||
|
def self.run_ltnp : LtnpOperator
|
||||||
|
io = IO::Memory.new
|
||||||
|
Process.run("netstat -ltnp", shell: true, output: io)
|
||||||
|
LtnpOperator.new io.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.run_kill(pid : String) : String
|
||||||
|
io = IO::Memory.new
|
||||||
|
Process.run("kill #{pid}", shell: true, output: io)
|
||||||
|
io.to_s
|
||||||
|
end
|
||||||
|
end
|
@ -1,7 +0,0 @@
|
|||||||
module NetstatRunner
|
|
||||||
def self.run_ltnp : LtnpOperator
|
|
||||||
io = IO::Memory.new
|
|
||||||
Process.run("sudo netstat -ltnp", shell: true, output: io)
|
|
||||||
LtnpOperator.new io.to_s
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue