Skip to content

Commit f18d1ed

Browse files
committed
remove xvfb option (that should be done when configuring orca command), add more_args argument for passing args to system command (mainly for electron)
1 parent 738adbc commit f18d1ed

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ matrix:
1010
- r: release
1111
env:
1212
- USE_VDIFFR=true
13-
- USE_XVFB=true
13+
- ARGS_VDIFFR="--disable-gpu"
1414
- r: oldrel
1515

1616
env:

R/orca.R

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file),
102102
#' @param window_max_number Sets maximum number of browser windows the server can keep open at a given time.
103103
#' @param request_limit Sets a request limit that makes orca exit when reached.
104104
#' @param quiet Suppress all logging info.
105-
#' @param xvfb Whether to run orca via X virtual framebuffer. May be necessary in a headless environment
105+
#' @param more_args additional arguments to pass along to system command. This is mainly useful
106+
#' for specifying electron options, such as `--disable-gpu`.
107+
#' @param ... arguments passed along to `processx::process$new()`.
106108
#'
107109
#' @section Methods:
108110
#'
@@ -129,7 +131,7 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file),
129131

130132
orca_serve <- function(port = 5151, mathjax = FALSE, safe = FALSE, request_limit = NULL,
131133
keep_alive = TRUE, window_max_number = NULL, quiet = FALSE,
132-
debug = FALSE, xvfb = FALSE, ...) {
134+
debug = FALSE, more_args = NULL, ...) {
133135

134136
# make sure we have the required infrastructure
135137
orca_available()
@@ -144,10 +146,11 @@ orca_serve <- function(port = 5151, mathjax = FALSE, safe = FALSE, request_limit
144146
"-p", port,
145147
"--plotly", plotlyjs_file,
146148
if (safe) "--safe-mode",
147-
#if (orca_version() >= "1.1.1") "--graph-only",
149+
if (orca_version() >= "1.1.1") "--graph-only",
148150
if (keep_alive) "--keep-alive",
149151
if (debug) "--debug",
150-
if (quiet) "--quiet"
152+
if (quiet) "--quiet",
153+
more_args
151154
)
152155

153156
if (!is.null(request_limit))
@@ -162,11 +165,7 @@ orca_serve <- function(port = 5151, mathjax = FALSE, safe = FALSE, request_limit
162165
if (isTRUE(mathjax))
163166
args <- c(args, "--mathjax", file.path(mathjax_path(), "MathJax.js"))
164167

165-
process <- if (xvfb) {
166-
processx::process$new("xvfb-run", c("orca", args), ...)
167-
} else {
168-
processx::process$new("orca", args, ...)
169-
}
168+
process <- processx::process$new("orca", args, ...)
170169

171170
list(
172171
port = port,

man/orca.Rd

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/helper-vdiffr.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ if (enable_vdiffr) {
2121
# make sure orca cli is available
2222
orca_available()
2323
# try and start up the node process
24-
orcaImageServer <- try(orca_serve(port, xvfb = as.logical(Sys.getenv("USE_XVFB", FALSE))), silent = TRUE)
24+
args <- Sys.getenv("ARGS_VDIFFR", NA)
25+
args <- if (is.na(args)) NULL else args
26+
orcaImageServer <- try(orca_serve(port, more_args = args), silent = TRUE)
2527
if (inherits(orcaImageServer, 'try-error')) {
2628
stop(
2729
"Tried to open orca server on port '", port, "', but it's not available. ",

0 commit comments

Comments
 (0)