fix: If running in Windows, do not use add_signal_handler() #274
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.
What is the issue?
SIGINT
to subprocess #75What was changed?
signal.raise_signal(signal.SIGINT)
via https://stackoverflow.com/questions/35772001/how-to-handle-a-signal-sigint-on-a-windows-os-machine/72637975#72637975. The trick is that we are dealing with sub-processes here. My Python knowledge is limited at this time since Windows can't use add_signal_handler - I wasn't quite sure how to best go this way to have the subprocess use it.Example
Attempting to run development in Windows with
loop.add_signal_handler
== to != for win32 check
Checking KeyboardInterrupt works
Other notes
We may also be able to set an event loop policy around if the platform we are running on is in Windows - before we get the event loop afterwards. However like I mentioned above my Python knowledge is limited, especially with how async/event loops are managed. I don't think it's a good idea to introduce it but I did want to mention I took a look anyways.
📚 Documentation preview 📚: https://meltano-edk--274.org.readthedocs.build/en/274/