Browse Source

Merge pull request #214 from jschultz/taskkill

Kill child processes as well as shell process
pull/196/merge
Chris 7 years ago
committed by GitHub
parent
commit
aa5e05aacc
1 changed files with 5 additions and 1 deletions
  1. 6
      gooey/gui/util/taskkill.py

6
gooey/gui/util/taskkill.py

@ -7,5 +7,9 @@ if sys.platform.startswith("win"):
def taskkill(pid):
os.system('taskkill /F /PID {:d} /T >NUL 2>NUL'.format(pid))
else: # POSIX
import psutil
def taskkill(pid):
os.kill(pid, signal.SIGTERM)
parent = psutil.Process(pid)
for child in parent.children(recursive=True):
child.kill()
parent.kill()
Loading…
Cancel
Save