R/on-load.R

Defines functions .onUnload .onLoad

## nocov start

.onLoad <- function(libname, pkgname) {
  ## This is needed to fix the boot time to a given value,
  ## because in a Docker container (maybe elsewhere as well?) on
  ## Linux it can change (!).
  ## See https://github.com/r-lib/processx/issues/258
  if (ps::ps_is_supported()) {
    ps::ps_handle()
    bt <- ps::ps_boot_time()
    .Call(c_processx__set_boot_time, bt)
  }

  supervisor_reset()
  if (Sys.getenv("DEBUGME", "") != "" &&
      requireNamespace("debugme", quietly = TRUE)) {
    debugme::debugme()
  }

  err$onload_hook()
}

.onUnload <- function(libpath) {
  chain_call(c_processx__unload_cleanup)
  supervisor_reset()
}

## nocov end

Try the processx package in your browser

Any scripts or data that you put into this service are public.

processx documentation built on May 29, 2024, 5:53 a.m.