title: Sending ^C to Python subprocess objects on Windows
body: <p>I have a test harness (written in Python) that needs to shut down the program under test (written in C) by sending it <kbd>^C</kbd>.  On Unix,</p>
  
  <pre><code>proc.send_signal(signal.SIGINT)
  </code></pre>
  
  <p>works perfectly.  On Windows, that throws an error ("signal 2 is not supported" or something like that).  I am using Python 2.7 for Windows, so I have the impression that I should be able to do instead</p>
  
  <pre><code>proc.send_signal(signal.CTRL_C_EVENT)
  </code></pre>
  
  <p>but this doesn't do anything at all.  What do I have to do?  This is the code that creates the subprocess:</p>
  
  <pre><code># Windows needs an extra argument passed to subprocess.Popen,
  # but the constant isn't defined on Unix.
  try: kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP
  except AttributeError: pass
  proc = subprocess.Popen(argv,
                          stdin=open(os.path.devnull, "r"),
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                          **kwargs)
  </code></pre>