Skip to content

Commit

Permalink
evalFuture(): Name local() environment 'future:evalenv'
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jan 3, 2025
1 parent 15191ea commit 7bdb606
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/expressions.R
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,12 @@ evalFuture <- function(
## -----------------------------------------------------------------
## Evaluate expression in a local() environment?
if (local) {
tmpl_expr_local <- bquote_compile(base::local(.(expr)))
tmpl_expr_local <- bquote_compile(base::local({
env <- base::environment()
base::attr(env, "name") <- "future:evalenv"
base::rm(list = "env")
.(expr)
}))
expr <- bquote_apply(tmpl_expr_local)
## WORKAROUND: This makes assumption about withCallingHandlers()
## and local(). In case this changes, provide internal options to
Expand Down

0 comments on commit 7bdb606

Please sign in to comment.