Modify exit handling to prevent test runner exit #730
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes take another step towards easier testing of RNS:
The TERM signal handler is now set up in rnsd.py as it needs to run on the main thread - the previous location caused errors in test runners.
The INTR signal is now handled by rnsd - the finally clause will shutdown Reticulum.
All the exit methods are now together and use flags to prevent them from being executed multiple times.
The os._exit() call in RNS.exit() is also commented out to prevent RNS from killing the Python interpreter at unexpected times (e.g. during test runs). RNS.exit() seems to be called only from LocalInterface.teardown() and seems to shutdown OK without the os._exit() call in my testing, but I'm not able to test under Android.
-Kevin