-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Description
I would like to be able to forcibly terminate a spawned process, like you can in Python (http://docs.python.org/2/library/subprocess.html#subprocess.Popen.terminate) or Java (http://docs.oracle.com/javase/7/docs/api/java/lang/Process.html#destroy%28%29).
There is currently a destroy method in the core::Program trait that closes stdin, waits for the process to finish and then closes stderr/stdout.
I am suggesting that either a new method be added to Program that forcibly kills the spawned process, or that the behaviour of destroy be changed to act in that way.
I think it would be better if the behaviour of destroy was changed because:
- I think that forcible termination is an intuitive behaviour for the name
destroy. - I don't think anybody is actually using the destroy method currently because, due to a bug in
core::run, a segfault will occur due to a double fclose if you actually call it.
Are there any objections to this? If not I can send a pull request with code/tests.