From 2eda0344d9ba7da5fdf91d56003dfbc16133f4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Fri, 5 Jun 2026 10:01:10 +0200 Subject: [PATCH] Use r_process$cleanup() instead of r_process$finalize() Future callr will move r_process$finalize() to private (as required by newer R6) and adds a public cleanup() method for explicit resource cleanup. Fall back to finalize() for compatibility with older callr versions. --- R/CallrFutureBackend-class.R | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/R/CallrFutureBackend-class.R b/R/CallrFutureBackend-class.R index 03845f5..6bb1199 100644 --- a/R/CallrFutureBackend-class.R +++ b/R/CallrFutureBackend-class.R @@ -464,7 +464,11 @@ await <- function(future, ...) { ## Finalize the 'callr' process, which includes remove any temporary ## files that it created - process$finalize() + if (is.function(process$cleanup)) { + process$cleanup() + } else { + process$finalize() + } } ## Failed to launch? @@ -538,8 +542,12 @@ await <- function(future, ...) { ## Finalize the 'callr' process, which includes remove any temporary ## files that it created - process$finalize() - + if (is.function(process$cleanup)) { + process$cleanup() + } else { + process$finalize() + } + result } # await()