1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#' Control whether standard output should be captured or not
#'
#' @usage fassignment \%stdout\% capture
#'
#' @inheritParams multiprocess
#'
#' @param fassignment The future assignment, e.g.
#' \code{x \%<-\% \{ expr \}}.
#'
#' @param capture If TRUE, the standard output will be captured, otherwise not.
#'
#' @export
`%stdout%` <- function(fassignment, capture) {
fassignment <- substitute(fassignment)
envir <- parent.frame(1)
## Temporarily set 'lazy' argument
args <- getOption("future.disposable", list())
args["stdout"] <- list(capture)
options(future.disposable = args)
eval(fassignment, envir = envir, enclos = baseenv())
}
|