File: on-load.R

package info (click to toggle)
r-cran-processx 3.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,068 kB
  • sloc: ansic: 6,485; sh: 13; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

## 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