sys
sys copied to clipboard
Prevent orphans
library(sys)
# system2 dies along with the parent proc
eval_fork({system2("ping", "localhost", wait = FALSE); Sys.sleep(3)})
# pipe breaks when interrupted, but process lives on! (on OSX at least)
eval_fork(exec_wait("ping", "localhost"), timeout = 3)
# but eval_background escapes (because of setpgid())
eval_fork(exec_background("ping", "localhost"))