feat: add support for port detection
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Glenn Y. Rolland 2024-02-14 14:51:15 +01:00
parent b588503b79
commit a007211e29

View file

@ -1,6 +1,7 @@
require "path"
require "file_utils"
require "socket"
require "./module"
require "./config"
@ -38,7 +39,12 @@ module DocMachine::Build
end
private def _port_available?(port)
true
sock = Socket.new(Socket::Family::INET, Socket::Type::STREAM)
sock.bind(Socket::IPAddress.new("0.0.0.0", port))
sock.close
return true
rescue ex : Socket::BindError
return false
end
private def _avoid_duplicates