yihui / servr

A simple HTTP server in R
https://cran.rstudio.com/package=servr
278 stars 35 forks source link

superfluous warning from random_port #39

Closed itcarroll closed 5 years ago

itcarroll commented 5 years ago

Calling random_port() gives the warning createTcpServer: address already in use. I think that's kind of already known ... given that you are requesting a non-default port. The warning also causes confusion when a R_SERVR_PORT environment variable is found by httd:

> Sys.getenv('R_SERVR_PORT')
[1] "4169"
> servr::httd('/path')
createTcpServer: address already in use
To stop the server, run servr::daemon_stop(1) or restart your R session
Serving the directory /path at http://127.0.0.1:4169

The specified address was not already in use, it's just that random_port() got (un-lazily, for whatever reason) evaluated. Maybe an easy solution is to remove that warning?

yihui commented 5 years ago

Should be fixed now. Thanks for the report!