Skip to content
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

Return result from kill() #255

Open
luke-waymark-addinsight opened this issue Sep 29, 2021 · 2 comments
Open

Return result from kill() #255

luke-waymark-addinsight opened this issue Sep 29, 2021 · 2 comments

Comments

@luke-waymark-addinsight
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Using the kill() method has no feedback. The childProcess.kill() method which python-shell uses internally returns a boolean describing the success of the operation, but it's not used. In fact it seems that python-shell assumes it was successfully killed as it sets terminated = true regardless of what happens.

Describe the solution you'd like
Return a boolean for success or failure of killing

@Almenon
Copy link
Collaborator

Almenon commented Oct 2, 2021

The kill() method() method already has a return value - it returns this allowing you to chain methods.

Although now that I think about it method chaining in this case is not really useful 🤔. If you kill the process you're probably done calling pythonshell methods.

So feel free to submit a PR changing this behavior if you wish and I'll review it.

@luke-waymark-addinsight
Copy link
Contributor Author

Perhaps rather than setting this.terminated = true blindly, it could instead do this.terminated = this.childProcess.kill(sig), that way you could check the returned object if it successfully terminated and perhaps try again with a more aggressive kill signal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants