Question:
Assume there’s no application listening at port 12340 in localhost.Shouldn’t the command below print “error” ?
Answer:
The current implementation ofnqp::connect
, the underlying logic to make the connection, throws an X::AdHoc
exception. Having IO::Socket::INET.new
return a Failure
if not able to connect, would make more sense to me indeed.I’ve created a Pull Request to create this behaviour.
Until then, you can use the same code change locally:
If you have better answer, please add a comment about this, thank you!