Run python script as a child process - #184
Open
copygirl wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes the python RPC wrapper addon to run the process in a thread using
executeinstead ofcreate_process, which is blocking but actually starts the process as a child process, ensuring that it is cleared up when the parent process (SnekStudio) is closed even if something goes horribly wrong either on the SnekStudio or Python side.There's a slight issue currently where, even thought it's recommended, I have to skip calling
wait_to_finishbecause it will just block forever. Ideally, the python process should gracefully close after its communication sockets are closed, but this appears to not be the case. Unfortunately I'm not familiar enough with the python code (or the language in general) to be able to debug this. (Funnily enough, if it was working properly, it'd be less likely we'd need to run it as a child process, but it's probably the right choice, anyway.)As a result, this currently prints the following warning:
Fixes #57.
Fixes #103.