From 118aa220f320801c3ddddbca273397806a0de488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Thu, 9 Sep 2021 16:49:57 +0200 Subject: [PATCH] stderr > stdout for rcmdcheck_process To keep output correctly interleaved. Closes #148. --- R/background.R | 7 ++++--- tests/testthat/test-rcmdcheck.R | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/R/background.R b/R/background.R index cbcfa80..dbc73ec 100644 --- a/R/background.R +++ b/R/background.R @@ -153,7 +153,8 @@ rcc_init <- function(self, private, super, path, args, build_args, cmdargs = c(basename(targz), args), libpath = libpath, repos = repos, - user_profile = TRUE + user_profile = TRUE, + stderr = "2>&1" ) with_envvar( @@ -172,8 +173,8 @@ rcc_parse_results <- function(self, private) { if (self$is_alive()) stop("Process still alive") ## Make sure all output is read out - self$read_output_lines() - self$read_error_lines() + if (self$has_output_connection()) self$read_output_lines() + if (self$has_error_connection()) self$read_error_lines() on.exit(unlink(private$tempfiles, recursive = TRUE), add = TRUE) diff --git a/tests/testthat/test-rcmdcheck.R b/tests/testthat/test-rcmdcheck.R index 780c839..5ffaf97 100644 --- a/tests/testthat/test-rcmdcheck.R +++ b/tests/testthat/test-rcmdcheck.R @@ -91,8 +91,6 @@ test_that("background gives same results", { test_path("bad1"), libpath = c(tmp_lib, .libPaths())) # If we read out the output, it'll still save it internally - bad1$read_output() - bad1$read_error() bad1$read_all_output_lines() res <- bad1$parse_results()