diff --git a/R/background.R b/R/background.R index 284974f..b8d9976 100644 --- a/R/background.R +++ b/R/background.R @@ -139,24 +139,25 @@ rcc_init <- function(self, private, super, path, args, build_args, # set up environment, start with callr safe set chkenv <- callr::rcmd_safe_env() + package <- private$description$get("Package")[[1]] + libdir <- file.path(dirname(targz), paste0(package, ".Rcheck")) + # if R_TESTS is set here, we'll skip the session_info, because we are # probably inside test cases of some package if (Sys.getenv("R_TESTS", "") == "") { private$session_output <- tempfile() private$tempfiles <- c(private$session_output, profile) - package <- private$description$get("Package")[[1]] - libdir <- file.path(dirname(targz), paste0(package, ".Rcheck")) profile <- make_fake_profile(package, private$session_output, libdir) chkenv["R_TESTS"] <- profile } # user supplied env vars take precedence if (length(env)) chkenv[names(env)] <- env - + options <- rcmd_process_options( cmd = "check", cmdargs = c(basename(targz), args), - libpath = libpath, + libpath = c(libdir, libpath), repos = repos, user_profile = FALSE, stderr = "2>&1", diff --git a/R/package.R b/R/package.R index 8b02c44..b967c74 100644 --- a/R/package.R +++ b/R/package.R @@ -197,11 +197,12 @@ do_check <- function(targz, package, args, libpath, repos, # set up environment, start with callr safe set chkenv <- callr::rcmd_safe_env() + libdir <- file.path(dirname(targz), paste0(package, ".Rcheck")) + # if R_TESTS is set here, we'll skip the session_info, because we are # probably inside test cases of some package if (Sys.getenv("R_TESTS", "") == "") { session_output <- tempfile() - libdir <- file.path(dirname(targz), paste0(package, ".Rcheck")) profile <- make_fake_profile(package, session_output, libdir) on.exit(unlink(profile), add = TRUE) chkenv["R_TESTS"] <- profile @@ -217,7 +218,7 @@ do_check <- function(targz, package, args, libpath, repos, res <- rcmd_safe( "check", cmdargs = c(basename(targz), args), - libpath = libpath, + libpath = c(libdir, libpath), user_profile = FALSE, repos = repos, stderr = "2>&1",