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 a DeferExitHandler function #848
Conversation
Useful for running exit handlers in the same order as defer statements
Hi, Is there any chance you guys could have a look at this one? We've been using it for a while now and it's proven very useful. Thanks |
@georgijd Can you describe the use case for controlling the order in which the exit handlers run? And why you couldn't just reorder your calls to |
Hi, Thank you for your response! A use-case would be if a library which utilises logrus already registers one or more exit handlers. Users of that library might need to run those exit handlers after their own exit handlers which would not be achievable if it's only possible to append exit handlers. I understand that in the majority of cases the exit handlers can be registered in the correct order, but sometimes that's just not possible. Regardless of whether the argument is compelling enough or not, it's always nice to allow people to control the order of such things. Especially when it comes to setup/cleanup procedures and there is little to no cost. |
@richpoirier this is a common and expected behaviour similar to what is done by atexit. The current implementation is kind of unexpected. |
Ok. @georgijd could you just update the functions' docs so that it's clear that Thanks for the PR btw 👍 |
Hi, Sorry for the delay. I've been quite busy lately. I've updated the diff with tests and new docstrings |
Thanks @georgijd! |
Useful for running exit handlers in the same order as defer statements