From c924b747c621656fb6f5e95cfa8a412ba0f11ac7 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Wed, 12 Jul 2023 15:09:19 +0200 Subject: [PATCH] Honor `RETICULATE_REMAP_OUTPUT_STREAMS` if it's set. --- R/output.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/output.R b/R/output.R index 79fba8a6d..53f0cb396 100644 --- a/R/output.R +++ b/R/output.R @@ -28,6 +28,11 @@ reset_output_streams <- function() { } set_knitr_python_stdout_hook <- function() { + # if the env var is set to 0, we respect it and never remap. If the env var is 1 + # this means that remapping is already set and we don't need the hook anyway. + if (!is.na(Sys.getenv("RETICULATE_REMAP_OUTPUT_STREAMS", unset = NA))) + return() + # we don't want to to force a knitr load namespace, so if it's already loaded # we set the knitr hook, otherwise we schedule an onLoad hook. if (isNamespaceLoaded("knitr")) {