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

ps_kill(p)

Arguments

p

Process handle.

See also

Examples

px <- processx::process$new("sleep", "10") p <- ps_handle(px$get_pid()) p
#> <ps::ps_handle> PID=17453, NAME=sleep, AT=2020-02-16 11:38:35
ps_kill(p)
#> NULL
p
#> <ps::ps_handle> PID=17453, NAME=???, AT=2020-02-16 11:38:35
#> [1] FALSE
px$get_exit_status()
#> [1] -9