Skip to content

Commit 1a2359f

Browse files
committed
quarto.quiet option needs to take precedence
1 parent f423a89 commit 1a2359f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

R/quarto.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ quarto_version <- function() {
4848

4949
#' @importFrom processx run
5050
quarto_run <- function(args = character(), quarto_bin = find_quarto(), echo = FALSE, echo_cmd = getOption("quarto.echo_cmd", FALSE), quiet = FALSE, ..., .call = rlang::caller_env()) {
51-
quiet <- getOption("quarto.quiet", FALSE) || quiet
51+
# this option takes precedence
52+
if (!is.na(getOption("quarto.quiet", NA))) quiet <- getOption("quarto.quiet", NA)
53+
# if quiet, add the flag to quarto call
5254
if (quiet) {
5355
if (!cli_arg_quiet() %in% args) args <- cli_arg_quiet(args)
5456
}

tests/testthat/test-quarto.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ test_that("quarto.quiet options controls echo and overwrite function argument",
8888
skip_if_no_quarto()
8989
skip_on_cran()
9090
qmd <- local_qmd_file("content")
91-
withr::local_options(list(quarto.quiet = TRUE))
92-
expect_output(quarto_render(qmd, quiet = FALSE), regexp = NA)
91+
withr::with_options(list(quarto.quiet = TRUE), {
92+
expect_output(quarto_render(qmd, quiet = FALSE), regexp = NA)
93+
})
94+
withr::with_options(list(quarto.quiet = FALSE), {
95+
expect_output(quarto_render(qmd, quiet = TRUE))
96+
})
9397
})

0 commit comments

Comments
 (0)