When starting a subprocess using Popen
and later trying to end it using terminate
, it can take over 10 seconds before the subprocess disappears from Windows Task Manager.
p = subprocess.Popen('foo.exe')
while True:
...
if quitProcess:
p.terminate()
Question: Is there a quicker way to quit the subprocess, ideally within a second?