title: Python: how to kill child process(es) when parent dies?
body: <p>The child process is started with</p>
  <pre><code>subprocess.Popen(arg)
  </code></pre>
  <p>Is there a way to ensure it is killed when parent terminates abnormally? I need this to work both on Windows and Linux. I am aware of this <a href="https://stackoverflow.com/questions/19447603/how-to-kill-a-python-child-process-created-with-subprocess-check-output-when-t/19448096#19448096">solution for Linux</a>.</p>
  <p><strong>Edit:</strong></p>
  <p>the requirement of starting a child process with <code>subprocess.Popen(arg)</code> can be relaxed, if a solution exists using a different method of starting a process.</p>