m3ng9i/ran

support using kernel assigned (random) port

Opened this issue · 0 comments

smoser commented

In some cases, knowing that a port will available is difficult.
Rather than guessing, it would be good to allow '--port=0' to let the kernel pick a port and have ran use that.

conveying the port to a consumer would be helpful but not entirely necessary. then you could do something like:

ran --port=0 my.dir > my.log 2>&1 &
url=""
while [ -z "$url" ];  do
  url=$(awk '$0 ~ /Listening on/ { print $7}' my.log)
 done
echo "listening on $url"