Sending signals to the child process.
Operating-System-level signals that can be sent via process_send_signal are defined in the 'subprocess::signals“ list. It is a list that is generated when the package is loaded and it contains only signals supported by the current platform (Windows or Linux).
All signals, both supported and not supported by the current
platform, are also exported under their names. If a given signal
is not supported on the current platform, then its value is set to
the appropriate OS routine (
WaitForSingleObject(), closing the process handle, etc.) that
effectively lets the operating system clean up after the child
process_send_signal() is not accompanied by
such clean-up and if the child process exits it needs to be followed
by a call to
process_terminate() on Linux sends the
SIGTERM signal to the process pointed to by
On Windows it calls
process_kill() on Linux sends the
handle. On Windows it is an alias for
process_send_signal() sends an OS-level
handle. In Linux all standard signal
numbers are supported. On Windows supported signals are
Those values will be available via the
signals list which
is also attached in the package namespace.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
Process handle obtained from
Signal number, one of
An object of class
In Windows, signals are delivered either only to the child process or
to the child process and all its descendants. This behavior is
controlled by the
termination_mode argument of the
subprocess::spawn_process() function. Setting it to
TERMINATION_GROUP results in signals being delivered to the
child and its descendants.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## Not run: # send the SIGKILL signal to bash h <- spawn_process('bash') process_signal(h, signals$SIGKILL) process_signal(h, SIGKILL) # is SIGABRT supported on the current platform? is.na(SIGABRT) ## End(Not run) ## Not run: # Windows process_send_signal(h, SIGTERM) process_send_signal(h, CTRL_C_EVENT) process_send_signal(h, CTRL_BREAK_EVENT) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.