views:

83

answers:

1

I create a subprocess using subprocess.Popen() that runs for a long time. It is called from its own thread, and the thread is blocked until the subprocess completes/returns.

I want to be able to interrupt the subprocess so the process terminates when I want.

Any ideas?

+3  A: 

I think you're looking for Popen.terminate or .kill function. They were added in python 2.6.

SilentGhost
+1 Didn't know that yet. Useful addition.
balpha