Ubuntu, linux support #2
|
@ -74,19 +74,18 @@ module Guard
|
|||
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
|
||||
}
|
||||
elsif RbConfig::CONFIG['host_os'] =~ /linux/
|
||||
%x{lsof -i :#{options[:port]}}.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
|
||||
|
|
Loading…
Reference in New Issue