Note that in some IDEs, e.g. RStudio or R.app on macOS, the IDE itself opens files from other threads, in addition to the files opened from the main R thread.

ps_open_files(p)

Arguments

p

Process handle.

Value

Data frame, or tibble if the tibble package is available, with columns: fd and path. fd is numeric file descriptor on POSIX systems, NA on Windows. path is an absolute path to the file.

Details

For a zombie process it throws a zombie_process error.

See also

Examples

p <- ps_handle() ps_open_files(p)
#> # A tibble: 5 x 2 #> fd path #> <int> <chr> #> 1 0 /dev/null #> 2 3 /tmp/Rtmp6B1y8T/callr-scr-43787155eb9 #> 3 4 anon_inode:[eventpoll] #> 4 5 anon_inode:[eventfd] #> 5 6 /dev/urandom
f <- file(tmp <- tempfile(), "w") ps_open_files(p)
#> # A tibble: 6 x 2 #> fd path #> <int> <chr> #> 1 0 /dev/null #> 2 3 /tmp/Rtmp6B1y8T/callr-scr-43787155eb9 #> 3 4 anon_inode:[eventpoll] #> 4 5 anon_inode:[eventfd] #> 5 6 /dev/urandom #> 6 8 /tmp/RtmpHaMKsq/file43f83e8ab2fb
close(f) unlink(tmp) ps_open_files(p)
#> # A tibble: 5 x 2 #> fd path #> <int> <chr> #> 1 0 /dev/null #> 2 3 /tmp/Rtmp6B1y8T/callr-scr-43787155eb9 #> 3 4 anon_inode:[eventpoll] #> 4 5 anon_inode:[eventfd] #> 5 6 /dev/urandom