Description
I see that in 3.1.2
an example was added to demonstrate how killing the process from a CTRL-C
handler can be done, however this masks an important distinction, which is that the process that launched our process can tell the difference between exit(0)
and termination due to raise(SIGINT)
, through WTERMSIG()
and friends.
Rust itself provides a small snippet to show how to reset the SIGINT
signal handler to SIG_DFL
, which would then allow a raise(SIGINT)
to terminate the rust process in the same way as if ctrlc
was not used.
This is particularly useful for "wrapper" executables such as juliaup
where it attempts to as transparently as possible launch a child process, and exit in the same way the child process exits. In this scenario, if the child process dies due to a SIGINT
, we want the wrapper process to also look like it died due to a SIGINT
.