From fd5aedcae6276271d9a1dbd3ed242f9a33527a00 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Tue, 25 Jul 2023 13:46:27 -0700 Subject: [PATCH] ensure renv unloaded on devtools::load_all() (#1591) --- R/aaa.R | 2 ++ R/zzz.R | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/R/aaa.R b/R/aaa.R index 639ae6ce1..687bb1dd6 100644 --- a/R/aaa.R +++ b/R/aaa.R @@ -1 +1,3 @@ + +# global variables the <- new.env(parent = emptyenv()) diff --git a/R/zzz.R b/R/zzz.R index 91b07f453..1c3215796 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -26,6 +26,13 @@ } +# NOTE: required for devtools::load_all() +.onDetach <- function(libpath) { + package <- Sys.getenv("DEVTOOLS_LOAD", unset = NA) + if (identical(package, .packageName)) + .onUnload(libpath) +} + renv_zzz_load <- function() { # NOTE: needs to be visible to embedded instances of renv as well