Running ‘CallrFuture.R’ [3s/6s]
  Running ‘callr.R’ [13s/22s]
  Running ‘demo.R’ [9s/9s]
Running the tests in ‘tests/demo.R’ failed.
Complete output:
  > source("incl/start.R")
  Loading required package: future
  plan(): nbrOfWorkers() = 2
  > 
  > options("R_FUTURE_DEMO_MANDELBROT_PLANES" = 4L)
  > 
  > message("*** Demos ...")
  *** Demos ...
  > 
  > message("*** Mandelbrot demo of the 'future' package ...")
  *** Mandelbrot demo of the 'future' package ...
  > 
  > plan(callr)
  plan(): nbrOfWorkers() = 2
  > demo("mandelbrot", package = "future", ask = FALSE)
  
  
  	demo(mandelbrot)
  	---- ~~~~~~~~~~
  
  > library("future")
  
  > library("graphics")
  
  > plot_what_is_done <- function(counts) {
  +   for (kk in seq_along(counts)) {
  +     f <- counts[[kk]]
  + 
  +     ## Already plotted?
  +     if (!inherits(f, "Future")) next
  + 
  +     ## Not resolved?
  +     if (!resolved(f)) next
  + 
  +     cat(sprintf("Plotting tile #%d of %d ...\n", kk, n))
  +     counts[[kk]] <- value(counts[[kk]])
  +     screen(kk)
  +     plot(counts[[kk]])
  +   }
  + 
  +   counts
  + }
  
  > ## Options
  > region <- getOption("future.demo.mandelbrot.region", 1L)
  
  > if (!is.list(region)) {
  +   if (region == 1L) {
  +     region <- list(xmid = -0.75, ymid = 0.0, side = 3.0)
  +   } else if (region == 2L) {
  +     region <- list(xmid = 0.283, ymid = -0.0095, side = 0.00026)
  +   } else if (region == 3L) {
  +     region <- list(xmid = 0.282989, ymid = -0.01, side = 3e-8)
  +   }
  + }
  
  > nrow <- getOption("future.demo.mandelbrot.nrow", 3L)
  
  > resolution <- getOption("future.demo.mandelbrot.resolution", 400L)
  
  > delay <- getOption("future.demo.mandelbrot.delay", interactive())
  
  > if (isTRUE(delay)) {
  +   delay <- function(counts) Sys.sleep(rexp(1, rate = 2))
  + } else if (!is.function(delay)) {
  +   delay <- function(counts) {}
  + }
  
  > ## Generate Mandelbrot tiles to be computed
  > Cs <- mandelbrot_tiles(xmid = region$xmid, ymid = region$ymid,
  +                        side = region$side, nrow = nrow,
  +                        resolution = resolution)
  
  > if (interactive()) {
  +   if (.Platform$GUI == "RStudio") {
  +     if (!"RStudioGD" %in% names(dev.list())) dev.new()
  +   }
  +   dev.new()
  +   plot.new()
  +   split.screen(dim(Cs))
  +   for (ii in seq_along(Cs)) {
  +     screen(ii)
  +     par(mar = c(0, 0, 0, 0))
  +     text(x = 1 / 2, y = 1 / 2, sprintf("Future #%d\nunresolved", ii), cex = 2)
  +   }
  + } else {
  +   split.screen(dim(Cs))
  + }
  [1] 1 2 3 4 5 6 7 8 9
  
  > counts <- list()
  
  > n <- length(Cs)
  
  > for (ii in seq_len(n)) {
  +   cat(sprintf("Mandelbrot tile #%d of %d ...\n", ii, n))
  +   C <- Cs[[ii]]
  + 
  +   counts[[ii]] <- future({
  +     cat(sprintf("Calculating tile #%d of %d ...\n", ii, n))
  +     fit <- mandelbrot(C)
  + 
  +     ## Emulate slowness
  +     delay(fit)
  + 
  +     cat(sprintf("Calculating tile #%d of %d ... done\n", ii, n))
  +     fit
  +   })
  + 
  +   ## Plot tiles that are already resolved
  +   counts <- plot_what_is_done(counts)
  + }
  Mandelbrot tile #1 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Launched future #19098
  Mandelbrot tile #2 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Launched future #19462
  Plotting tile #1 of 9 ...
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
   'Mandelbrot' int [1:134, 1:134] 1 1 1 1 1 1 1 1 1 1 ...
   - attr(*, "params")=List of 3
    ..$ Z      : cplx [1:134, 1:134] -2.25-1.5i -2.25-1.49i -2.25-1.49i ...
    .. ..- attr(*, "region")=List of 2
    .. .. ..$ xrange: num [1:2] -2.25 -1.25
    .. .. ..$ yrange: num [1:2] -1.5 -0.505
    .. ..- attr(*, "tile")= int [1:2] 1 1
    ..$ maxIter: int 200
    ..$ tau    : num 2
  Mandelbrot tile #3 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Poll #1 (0): usedWorkers() = 2, workers = 2
  Launched future #19596
  Mandelbrot tile #4 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Poll #1 (0): usedWorkers() = 2, workers = 2
  Poll #2 (0.23 secs): usedWorkers() = 2, workers = 2
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
   'Mandelbrot' int [1:134, 1:134] 1 1 1 1 1 1 1 1 1 1 ...
   - attr(*, "params")=List of 3
    ..$ Z      : cplx [1:134, 1:134] -1.25-1.5i -1.25-1.49i -1.25-1.49i ...
    .. ..- attr(*, "region")=List of 2
    .. .. ..$ xrange: num [1:2] -1.248 -0.252
    .. .. ..$ yrange: num [1:2] -1.5 -0.505
    .. ..- attr(*, "tile")= int [1:2] 1 2
    ..$ maxIter: int 200
    ..$ tau    : num 2
  Launched future #19784
  Plotting tile #2 of 9 ...
  Mandelbrot tile #5 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Poll #1 (0): usedWorkers() = 2, workers = 2
  Poll #2 (0.2 secs): usedWorkers() = 2, workers = 2
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
   'Mandelbrot' int [1:134, 1:134] 1 1 1 1 1 1 1 1 1 1 ...
   - attr(*, "params")=List of 3
    ..$ Z      : cplx [1:134, 1:134] -0.25-1.5i -0.25-1.49i -0.25-1.49i ...
    .. ..- attr(*, "region")=List of 2
    .. .. ..$ xrange: num [1:2] -0.245 0.75
    .. .. ..$ yrange: num [1:2] -1.5 -0.505
    .. ..- attr(*, "tile")= int [1:2] 1 3
    ..$ maxIter: int 200
    ..$ tau    : num 2
  Launched future #19911
  Plotting tile #3 of 9 ...
  Mandelbrot tile #6 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Poll #1 (0): usedWorkers() = 2, workers = 2
  Poll #2 (0.2 secs): usedWorkers() = 2, workers = 2
  Poll #3 (0.4 secs): usedWorkers() = 2, workers = 2
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
   'Mandelbrot' int [1:134, 1:134] 1 1 1 1 1 1 1 1 1 1 ...
   - attr(*, "params")=List of 3
    ..$ Z      : cplx [1:134, 1:134] -2.25-0.5i -2.25-0.49i -2.25-0.48i ...
    .. ..- attr(*, "region")=List of 2
    .. .. ..$ xrange: num [1:2] -2.25 -1.25
    .. .. ..$ yrange: num [1:2] -0.498 0.498
    .. ..- attr(*, "tile")= int [1:2] 2 1
    ..$ maxIter: int 200
    ..$ tau    : num 2
  Launched future #20060
  Plotting tile #4 of 9 ...
  Mandelbrot tile #7 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Poll #1 (0): usedWorkers() = 2, workers = 2
  Poll #2 (0.2 secs): usedWorkers() = 2, workers = 2
  Poll #3 (0.41 secs): usedWorkers() = 2, workers = 2
  Poll #4 (0.61 secs): usedWorkers() = 2, workers = 2
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
   'Mandelbrot' int [1:134, 1:134] 3 4 4 4 4 5 5 5 5 6 ...
   - attr(*, "params")=List of 3
    ..$ Z      : cplx [1:134, 1:134] -1.25-0.5i -1.25-0.49i -1.25-0.48i ...
    .. ..- attr(*, "region")=List of 2
    .. .. ..$ xrange: num [1:2] -1.248 -0.252
    .. .. ..$ yrange: num [1:2] -0.498 0.498
    .. ..- attr(*, "tile")= int [1:2] 2 2
    ..$ maxIter: int 200
    ..$ tau    : num 2
  Launched future #20391
  Plotting tile #5 of 9 ...
  Mandelbrot tile #8 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Poll #1 (0): usedWorkers() = 2, workers = 2
  Poll #2 (0.2 secs): usedWorkers() = 2, workers = 2
  Poll #3 (0.4 secs): usedWorkers() = 2, workers = 2
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
   'Mandelbrot' int [1:134, 1:134] 200 200 200 200 200 200 200 200 200 200 ...
   - attr(*, "params")=List of 3
    ..$ Z      : cplx [1:134, 1:134] -0.245-0.498i -0.245-0.49i -0.245-0.483i ...
    .. ..- attr(*, "region")=List of 2
    .. .. ..$ xrange: num [1:2] -0.245 0.75
    .. .. ..$ yrange: num [1:2] -0.498 0.498
    .. ..- attr(*, "tile")= int [1:2] 2 3
    ..$ maxIter: int 200
    ..$ tau    : num 2
  Launched future #20607
  Plotting tile #6 of 9 ...
  Mandelbrot tile #9 of 9 ...
  getGlobalsAndPackages() ...
  Searching for globals ...
  - globals found: [9] '{', 'cat', 'sprintf', 'ii', 'n', '<-', 'mandelbrot', 'C', 'delay'
  Searching for globals ... DONE
  Resolving globals: FALSE
  The total size of the 4 globals is 284.78 KiB (291616 bytes)
  - globals: [4] 'ii', 'n', 'C', 'delay'
  - packages: [1] 'future'
  getGlobalsAndPackages() ... DONE
  Packages needed by future strategies (n = 0): <none>
  Packages needed by the future expression (n = 1): 'future'
  {
      {
          ...future.oldOptions <- options(future.startup.loadScript = FALSE, 
              future.globals.onMissing = "ignore")
          {
              {
                  NULL
                  local({
                    for (pkg in "future") {
                      loadNamespace(pkg)
                      library(pkg, character.only = TRUE)
                    }
                  })
              }
              future::plan("default", .cleanup = FALSE, .init = FALSE)
          }
      }
      tryCatch({
          local({
              cat(sprintf("Calculating tile #%d of %d ...\n", ii, 
                  n))
              fit <- mandelbrot(C)
              delay(fit)
              cat(sprintf("Calculating tile #%d of %d ... done\n", 
                  ii, n))
              fit
          })
      }, finally = {
          {
              {
                  NULL
                  future::plan(list(function (expr, envir = parent.frame(), 
                    substitute = TRUE, globals = TRUE, label = NULL, 
                    workers = availableCores(), ...) 
                  {
                    if (substitute) 
                      expr <- substitute(expr)
                    if (is.null(workers)) 
                      workers <- availableCores()
                    stopifnot(length(workers) == 1L, is.numeric(workers), 
                      is.finite(workers), workers >= 1L)
                    future <- CallrFuture(expr = expr, envir = envir, 
                      substitute = FALSE, globals = globals, label = label, 
                      workers = workers, ...)
                    if (!future$lazy) 
                      future <- run(future)
                    future
                  }), .cleanup = FALSE, .init = FALSE)
              }
              options(...future.oldOptions)
          }
      })
  }
  Poll #1 (0): usedWorkers() = 2, workers = 2
  Poll #2 (0.2 secs): usedWorkers() = 2, workers = 2
  Poll #3 (0.41 secs): usedWorkers() = 2, workers = 2
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
   'Mandelbrot' int [1:134, 1:134] 1 1 1 1 1 1 1 1 1 1 ...
   - attr(*, "params")=List of 3
    ..$ Z      : cplx [1:134, 1:134] -2.25+0.5i -2.25+0.51i -2.25+0.52i ...
    .. ..- attr(*, "region")=List of 2
    .. .. ..$ xrange: num [1:2] -2.25 -1.25
    .. .. ..$ yrange: num [1:2] 0.505 1.5
    .. ..- attr(*, "tile")= int [1:2] 3 1
    ..$ maxIter: int 200
    ..$ tau    : num 2
  Launched future #20836
  Plotting tile #7 of 9 ...
  Plotting tile #8 of 9 ...
  callr::wait() ...
  - status(): 'done'
  callr::wait() ... done
  Results:
  Future state: 'failed'
  Error: callr failed, could not start R, or it has crashed or was killed 
  Execution halted