title: Windows equivalent for spawning and killing separate process group in Python 3?
body: <p>I have a web server that needs to manage a separate multi-process subprocess (i.e. starting it and killing it).</p>
  
  <p>For Unix-based systems, the following works fine:</p>
  
  <pre><code># save the pid as `pid`
  ps = subprocess.Popen(cmd, preexec_fn=os.setsid)
  
  # elsewhere:
  os.killpg(os.getpgid(pid), signal.SIGTERM)
  </code></pre>
  
  <p>I'm doing it this way (with <code>os.setsid</code>) because otherwise killing the progress group will also kill the web server.</p>
  
  <p>On Windows these <code>os</code> functions are not available -- so if I wanted to accomplish something similar on Windows, how would I do this?</p>
  
  <p>I'm using Python 3.5.</p>