I seem to be unable to fork a new process in Rstudio using mcfork
from parallel
, though this works in a standard R console on linux / OS X. Is there an alternative workaround to forking a subprocess in Rstudio.
For example, consider this function:
library(parallel)
f <- function() {
p <- parallel:::mcfork()
if (inherits(p, "masterProcess")) {
cat("I'm a child!")
parallel:::mcexit()
}
cat("I'm the master\n")
}
In my standard R console I get the expected output:
I'm the master
> I'm a child!
But in Rstudio, I get:
I'm the master