Skip to content

Commit

Permalink
Merge pull request chriskiehl#214 from jschultz/taskkill
Browse files Browse the repository at this point in the history
Kill child processes as well as shell process
  • Loading branch information
chriskiehl authored Aug 4, 2017
2 parents 7a818f3 + 2145ee5 commit aa5e05a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gooey/gui/util/taskkill.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
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()

0 comments on commit aa5e05a

Please sign in to comment.