Skip to content

Commit 16ee6fc

Browse files
committed
Don't use withr and pass env to the processx call directly
1 parent b600d97 commit 16ee6fc

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Imports:
2727
rstudioapi,
2828
tools,
2929
utils,
30-
withr,
3130
yaml
3231
Suggests:
3332
bslib,

R/quarto.R

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,32 @@ quarto_run <- function(
129129
...,
130130
.call = rlang::caller_env()
131131
) {
132-
# handle R_LIBS
132+
# To store any environment variables to pass to the process
133+
custom_env <- NULL
134+
135+
# handle session .libpaths() for background session
136+
# It needs to be passed if .libPaths() was modified in the current R session
137+
# (e.g. to install dev package in a temporary library)
133138
opt_in_libpath <- getOption("quarto.use_libpaths", TRUE)
134139
if (isTRUE(opt_in_libpath) && !is.null(libpaths)) {
135-
withr::local_envvar(list(
140+
custom_env <- c(
141+
custom_env,
136142
R_LIBS = paste(libpaths, collapse = .Platform$path.sep)
137-
))
143+
)
138144
}
139145

140146
# This is required due to a bug in QUARTO CLI, fixed only in 1.8+
141147
# https://github.com/quarto-dev/quarto-cli/pull/12887
142-
custom_env <- NULL
143148
if (!quarto_available(min = "1.8.13")) {
144-
custom_env <- c("current", QUARTO_R = R.home("bin"))
149+
custom_env <- c(custom_env, QUARTO_R = R.home("bin"))
145150
}
151+
152+
# This is required because `"current"` only is not supported by processx
153+
# FIXME: https://github.com/r-lib/processx/issues/399
154+
if (!is.null(custom_env)) {
155+
custom_env <- c("current", custom_env)
156+
}
157+
146158
res <- tryCatch(
147159
{
148160
processx::run(

0 commit comments

Comments
 (0)