`deferred_run` doesn't find attached handlers
Closed this issue · 1 comments
dfalbel commented
I wonder if this is the expected behavior of deferred_run
:
env <- rlang::new_environment()
local_print <- function(path) {
withr::defer(print("defered"), envir = env)
attributes(env)
}
local({
local_print()
})
#> NULL
withr::deferred_run(env)
#> No deferred expressions to run
I know that deferred_run
is mostly inteded to run actions in the global environment:
The global environment scenario is the main motivation for these functions.
FWIW deferred_run()
executes the deferred expression in withr 2.5
lionel- commented
yep expected, it will only work if env
is a frame environment currently on the call stack