12 changed files with 94 additions and 17 deletions
@ -0,0 +1,2 @@ |
|||
YEAR: 2017 |
|||
COPYRIGHT HOLDER: Bob Rudis |
@ -0,0 +1,22 @@ |
|||
.prime_url <- function(url, prime_ct = 1, chrome_bin=Sys.getenv("HEADLESS_CHROME")) { |
|||
|
|||
args <- c("--headless") |
|||
args <- c(args, "--disable-gpu") |
|||
args <- c(args, "--no-sandbox") |
|||
args <- c(args, "--allow-no-sandbox-job") |
|||
args <- c(args, sprintf("--user-data-dir=%s", .get_app_dir())) |
|||
args <- c(args, sprintf("--crash-dumps-dir=%s", .get_app_dir())) |
|||
args <- c(args, sprintf("--utility-allowed-dir=%s", .get_app_dir())) |
|||
args <- c(args, "--dump-dom", url) |
|||
|
|||
for (i in 1:prime_ct) { |
|||
processx::run( |
|||
command = chrome_bin, |
|||
args = args, |
|||
error_on_status = FALSE, |
|||
echo_cmd = FALSE, |
|||
echo = FALSE |
|||
) -> res |
|||
} |
|||
|
|||
} |
@ -1,10 +1,14 @@ |
|||
#' Get Chrome version |
|||
#' |
|||
#' @md |
|||
#' @param quiet if `TRUE`, no messages are displayed |
|||
#' @param chrome_bin the path to Chrome (auto-set from `HEADLESS_CHROME` environment variable) |
|||
#' @return the Chrome version string (invisibly) |
|||
#' @export |
|||
#' @examples |
|||
#' chrome_version() |
|||
chrome_version <- function(chrome_bin=Sys.getenv("HEADLESS_CHROME")) { |
|||
system2(chrome_bin, "--version") |
|||
chrome_version <- function(quiet = FALSE, chrome_bin=Sys.getenv("HEADLESS_CHROME")) { |
|||
res <- processx::run(chrome_bin, "--version") |
|||
if (!quiet) message(res$stdout) |
|||
return(invisible(trimws(res$stdout))) |
|||
} |
Loading…
Reference in new issue