Skip to content

Kill the current process with SIGKILL preemptively checking whether PID has been reused. On Windows it uses TerminateProcess().

Usage

ps_kill(p = ps_handle())

Arguments

p

Process handle.

Examples

px <- processx::process$new("sleep", "10")
p <- ps_handle(px$get_pid())
p
#> <ps::ps_handle> PID=7484, NAME=sleep, AT=2024-01-21 20:58:04.16
ps_kill(p)
#> NULL
p
#> <ps::ps_handle> PID=7484, NAME=???, AT=2024-01-21 20:58:04.16
ps_is_running(p)
#> [1] FALSE
px$get_exit_status()
#> [1] -9