clean up lsof on both OSes
This commit is contained in:
parent
3c52debcab
commit
2654061350
|
@ -74,14 +74,8 @@ module Guard
|
||||||
end
|
end
|
||||||
|
|
||||||
def unmanaged_pid
|
def unmanaged_pid
|
||||||
pid_command =
|
pid_command = "lsof -n -i TCP:#{options[:port]}"
|
||||||
case RbConfig::CONFIG['host_os']
|
%x{pid_command}.each_line { |line|
|
||||||
when /darwin/i
|
|
||||||
'lsof -P'
|
|
||||||
when /linux/i
|
|
||||||
"lsof -i :#{options[:port]}"
|
|
||||||
end
|
|
||||||
%x{#{pid_command}}.each_line { |line|
|
|
||||||
if line["*:#{options[:port]} "]
|
if line["*:#{options[:port]} "]
|
||||||
return line.split("\s")[1]
|
return line.split("\s")[1]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue