@@ -48,7 +48,11 @@ launchFuture.CallrFutureBackend <- local({
4848 # # MEMOIZATION
4949 evalFuture <- import_future(" evalFuture" )
5050 getFutureData <- import_future(" getFutureData" )
51- with_stealth_rng <- import_future(" with_stealth_rng" )
51+ with_stealth_rng <- if (packageVersion(" processx" ) > = " 3.8.6" ) {
52+ identity
53+ } else {
54+ import_future(" with_stealth_rng" )
55+ }
5256
5357 cmdargs <- NULL
5458
@@ -126,7 +130,8 @@ launchFuture.CallrFutureBackend <- local({
126130
127131
128132 # # Launch
129- # # WORKAROUND: callr::r_bg() updates the RNG state
133+ # # WORKAROUND: callr::r_bg() -> ... -> processx:::get_id() updates
134+ # # the RNG state. This was fixed in processx 3.8.6 (2025-02-21).
130135 with_stealth_rng({
131136 future [[" process" ]] <- r_bg(func , args = r_bg_args , stdout = stdout , stderr = stderr , cmdargs = cmdargs , supervise = supervise )
132137 })
@@ -456,6 +461,10 @@ await <- function(future, ...) {
456461 if (FutureRegistry(reg , action = " contains" , future = future )) {
457462 FutureRegistry(reg , action = " remove" , future = future )
458463 }
464+
465+ # # Finalize the 'callr' process, which includes remove any temporary
466+ # # files that it created
467+ process $ finalize()
459468 }
460469
461470 # # Failed to launch?
@@ -526,6 +535,10 @@ await <- function(future, ...) {
526535
527536 reg <- backend [[" reg" ]]
528537 FutureRegistry(reg , action = " remove" , future = future )
538+
539+ # # Finalize the 'callr' process, which includes remove any temporary
540+ # # files that it created
541+ process $ finalize()
529542
530543 result
531544} # await()
0 commit comments