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, or a list of process handles.

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=7467, NAME=sleep, AT=2024-10-29 08:52:09.96
ps_send_signal(p, signals()$SIGINT)
#> NULL
p
#> <ps::ps_handle> PID=7467, NAME=???, AT=2024-10-29 08:52:09.96
ps_is_running(p)
#> [1] FALSE
px$get_exit_status()
#> [1] -2