dwww Home | Show directory contents | Find package

test_that("process is cleaned up", {

  px <- get_tool("px")
  p <- process$new(px, c("sleep", "1"), cleanup = TRUE)
  pid <- p$get_pid()

  rm(p)
  gc()

  expect_false(process__exists(pid))
})

test_that("process can stay alive", {

  px <- get_tool("px")

  on.exit(tools::pskill(pid, 9), add = TRUE)
  p <- process$new(px, c("sleep", "60"), cleanup = FALSE)
  pid <- p$get_pid()

  rm(p)
  gc()

  expect_true(process__exists(pid))
})

Generated by dwww version 1.15 on Thu May 23 18:58:02 CEST 2024.