Skip to content

Send a signal to the process. Not implemented on Windows. See signals() for the list of signals on the current platform.

Usage

ps_send_signal(p = ps_handle(), sig)

Arguments

p

Process handle.

sig

Signal number, see signals().

Details

It checks if the process is still running, before sending the signal, to avoid signalling the wrong process, because of pid reuse.

Examples

px <- processx::process$new("sleep", "10")
p <- ps_handle(px$get_pid())
p
#> <ps::ps_handle> PID=11594, NAME=sleep, AT=2022-06-18 08:48:59
ps_send_signal(p, signals()$SIGINT)
#> NULL
p
#> <ps::ps_handle> PID=11594, NAME=???, AT=2022-06-18 08:48:59
ps_is_running(p)
#> [1] FALSE
px$get_exit_status()
#> [1] -2