Sending Cntrl-C ??
Christian Heimes
lists at cheimes.de
Tue Apr 29 17:48:12 EDT 2008
gamename schrieb:
> Hi,
>
> I really like this recipe for controlling subprocesses:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554
>
> However, I can't figure out how I can send the equivalent of "Cntrl-C"
> to the subprocess. How can that be done?
import os
import signal
import subprocess
popen = subprocess(...)
os.kill(popen.pid, signal.SIGINT)
Or with Python 2.6+:
popen.send_signal(signal.SIGINT)
Christian
More information about the Python-list
mailing list