Ubuntu, linux support #2

Merged
sid137 merged 2 commits from master into master 2011-06-29 13:53:55 +00:00

View File

@ -74,19 +74,18 @@ module Guard
end end
def unmanaged_pid def unmanaged_pid
if RbConfig::CONFIG['host_os'] =~ /darwin/ pid_command =
%x{lsof -P}.each_line { |line| case RbConfig::CONFIG['host_os']
if line["*:#{options[:port]} "] when /darwin/i
return line.split("\s")[1] 'lsof -P'
end when /linux/i
} "lsof -i :#{options[:port]}"
elsif RbConfig::CONFIG['host_os'] =~ /linux/ end
%x{lsof -i :#{options[:port]}}.each_line { |line| %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
} }
end
nil nil
end end
end end