@@ -187,6 +187,34 @@ nbrOfFreeWorkers.CallrFutureBackend <- function(evaluator = NULL, background = F
187187}
188188
189189
190+
191+ # ' @exportS3Method getFutureBackendConfigs CallrFutureBackend
192+ getFutureBackendConfigs.CallrFutureBackend <- local({
193+ immediateConditionsPath <- import_future(" immediateConditionsPath" )
194+ fileImmediateConditionHandler <- import_future(" fileImmediateConditionHandler" )
195+
196+ function (future , ... , debug = isTRUE(getOption(" future.debug" ))) {
197+ conditionClasses <- future [[" conditions" ]]
198+ if (is.null(conditionClasses )) {
199+ capture <- list ()
200+ } else {
201+ path <- immediateConditionsPath(rootPath = tempdir())
202+ capture <- list (
203+ immediateConditionHandlers = list (
204+ immediateCondition = function (cond ) {
205+ fileImmediateConditionHandler(cond , path = path )
206+ }
207+ )
208+ )
209+ }
210+
211+ list (
212+ capture = capture
213+ )
214+ }
215+ })
216+
217+
190218# ' Prints a callr future
191219# '
192220# ' @param x An CallrFuture object
@@ -233,6 +261,15 @@ resolved.CallrFuture <- function(x, .signalEarly = TRUE, ...) {
233261 if (! inherits(process , " r_process" )) return (FALSE )
234262 resolved <- ! process $ is_alive()
235263
264+ # # Collect and relay immediateCondition if they exists
265+ conditions <- readImmediateConditions(signal = TRUE )
266+ # # Record conditions as signaled
267+ signaled <- c(x [[" .signaledConditions" ]], conditions )
268+ x [[" .signaledConditions" ]] <- signaled
269+
270+ # # Signal conditions early? (happens only iff requested)
271+ if (.signalEarly ) signalEarly(x , ... )
272+
236273 # # Signal errors early?
237274 if (.signalEarly && resolved ) {
238275 # # Trigger a FutureError already here, if exit code != 0
@@ -257,6 +294,12 @@ result.CallrFuture <- function(future, ...) {
257294
258295 result <- await(future , cleanup = FALSE )
259296
297+ # # Collect and relay immediateCondition if they exists
298+ conditions <- readImmediateConditions()
299+ # # Record conditions as signaled
300+ signaled <- c(future [[" .signaledConditions" ]], conditions )
301+ future [[" .signaledConditions" ]] <- signaled
302+
260303 if (! inherits(result , " FutureResult" )) {
261304 if (inherits(result , " FutureLaunchError" )) {
262305 } else {
0 commit comments