From fac62ca05d33546f1974baa8d1b3835a61e6a18a Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Tue, 26 May 2020 20:52:18 -0500 Subject: [PATCH] revert d2bf03625beafb94c6feb0b210f43cde4efae30b: servr::random_port() is quiet now --- DESCRIPTION | 2 +- R/chrome.R | 4 ++-- R/utils.R | 4 ---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 07e81598..9f6cc5ca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,7 +20,7 @@ Description: Use the paged media properties in CSS and the JavaScript running headers, etc. Applications of this package include books, letters, reports, papers, business cards, resumes, and posters. Imports: rmarkdown (>= 1.16), bookdown (>= 0.8), htmltools, jsonlite, later (>= 1.0.0), - processx, servr (>= 0.13), httpuv, xfun, websocket + processx, servr (>= 0.18), httpuv, xfun, websocket Suggests: promises, testit, xaringan, pdftools, revealjs License: MIT + file LICENSE URL: https://github.com/rstudio/pagedown diff --git a/R/chrome.R b/R/chrome.R index 014b9ee7..815a3ad0 100644 --- a/R/chrome.R +++ b/R/chrome.R @@ -79,7 +79,7 @@ chrome_print = function( '--headless', '--no-first-run', '--no-default-browser-check', '--hide-scrollbars' )) - debug_port = random_port() + debug_port = servr::random_port() ps = processx::process$new(browser, c( paste0('--remote-debugging-port=', debug_port), paste0('--user-data-dir=', work_dir), extra_args @@ -132,7 +132,7 @@ chrome_print = function( ) svr = servr::httd( dirname(url), daemon = TRUE, browser = FALSE, verbose = verbose >= 1, - port = random_port(), initpath = httpuv::encodeURIComponent(basename(url)) + port = servr::random_port(), initpath = httpuv::encodeURIComponent(basename(url)) ) stop_server = function(...) { if (verbose >= 1) message('Closing local webserver') diff --git a/R/utils.R b/R/utils.R index e5d0a940..8511969b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -32,10 +32,6 @@ to_json = function(x, ..., auto_unbox = TRUE, null = 'null') { jsonlite::toJSON(x, ..., auto_unbox = auto_unbox, null = null) } -# don't prefer the port 4321 (otherwise we may see the meaningless error message -# "createTcpServer: address already in use" too often) -random_port = function() servr::random_port(NULL) - `%n%` = knitr:::`%n%` run_servr = function() {