From 8a083a481a67f13808bd8ee8f2302692c45b7963 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Wed, 31 Jan 2024 18:58:42 +0100 Subject: [PATCH] Avoid double printing error message quarto does put everything in stderr so when error we were printing two times. Let's catch first, and then print non error output if any --- R/quarto.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/quarto.R b/R/quarto.R index e4ea6b7..a312f40 100644 --- a/R/quarto.R +++ b/R/quarto.R @@ -49,7 +49,7 @@ quarto_version <- function() { #' @importFrom processx run quarto_run <- function(args = character(), quarto_bin = find_quarto(), echo = FALSE, echo_cmd = getOption("quarto.echo_cmd", FALSE), ..., .call = rlang::caller_env()) { res <- tryCatch({ - processx::run(quarto_bin, args = args, echo = echo, error_on_status = TRUE, echo_cmd = echo_cmd, ...) + processx::run(quarto_bin, args = args, echo = FALSE, error_on_status = TRUE, echo_cmd = echo_cmd, ...) }, error = function(e) { msg <- c("Error running quarto cli:") @@ -58,6 +58,11 @@ quarto_run <- function(args = character(), quarto_bin = find_quarto(), echo = FA rlang::abort(msg, call = .call, parent = e) } ) + # quarto outputs any message into stderr as stdout is reserved + # for regular rendered output (that we don't support in this package yet) + if (echo && nzchar(res$stderr)) { + cli::cat_line(res$stderr) + } invisible(res) }