Skip to content

Add a terminate/kill method to core::run::Program (or make destroy kill the process) #5632

Closed
@Dretch

Description

@Dretch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions