-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add revert_to_default()
or similar
#106
Comments
I'd like to see this feature implemented in a way where the user would set the handler with a builder of some sort that had an option to not inherit the signal handlers for a child processes. However in practice I think this is very tricky, if not impossible. Could you have a wrapper executable in juliaup that would (re)set the handlers to SIG_DFL using |
Yes, |
If I understand correctly, in Now that I wrote it out, I realized it may still be beneficial to have the feature as you could use it in the wrapper child process to revert the handlers, should you decide to implement it that way. |
Not quite, we start up the signal handlers as soon as the child process launches (ignoring |
I'm also looking for the ability to remove a ctrlc handler. In my case I'm interested in building a CLI interaction library (think readline) that ought to handle ctrl-c internally, but then should return things to their original state when handing back control to the user. It seems logical to me that |
The handle object approach would not work with child processes though as they inherit the signal handlers (on *nix). Now that I'm reading this discussion again I'm starting to think a separate function for setting signal handlers back to |
I see that in
3.1.2
an example was added to demonstrate how killing the process from aCTRL-C
handler can be done, however this masks an important distinction, which is that the process that launched our process can tell the difference betweenexit(0)
and termination due toraise(SIGINT)
, throughWTERMSIG()
and friends.Rust itself provides a small snippet to show how to reset the
SIGINT
signal handler toSIG_DFL
, which would then allow araise(SIGINT)
to terminate the rust process in the same way as ifctrlc
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 aSIGINT
, we want the wrapper process to also look like it died due to aSIGINT
.The text was updated successfully, but these errors were encountered: