inst/testme/test-utils,pid.R
raw| 1 | library(parallelly) |
| 2 | |
| 3 | message("*** utils,pid ...") |
| 4 | |
| 5 | pid_exists <- parallelly:::pid_exists |
| 6 | |
| 7 | ## Test with current process |
| 8 | res <- pid_exists(Sys.getpid()) |
| 9 | print(res) |
| 10 | stopifnot(isTRUE(res)) |
| 11 | |
| 12 | ## Test with current process |
| 13 | res <- pid_exists(Sys.getpid(), debug = TRUE) |
| 14 | print(res) |
| 15 | stopifnot(isTRUE(res)) |
| 16 | |
| 17 | ## Exceptions |
| 18 | res <- tryCatch(pid_exists(0L), error = identity) |
| 19 | stopifnot(inherits(res, "error")) |
| 20 | |
| 21 | message("*** utils,pid ... DONE") |