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=8460, NAME=sleep, AT=2026-04-30 07:36:31.899231
ps_send_signal(p, signals()$SIGINT)
#> NULL
p
#> <ps::ps_handle> PID=8460, NAME=???, AT=2026-04-30 07:36:31.899231
ps_is_running(p)
#> [1] FALSE
px$get_exit_status()
#> [1] -2