diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-04-06 15:48:06 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-04-09 13:53:09 -0300 |
commit | 1644e9effe528aa2f95de4c4726704028b0fabc8 (patch) | |
tree | 6b7b477d03f650cc003083cc827a428e4ae9b8fd | |
parent | f745288f4ddf49e72604709f3c1eb75e47b3b369 (diff) |
[bug] enable atexit subprocess termination
- Resolves: #6426
- Resolves: #6681
-rw-r--r-- | src/leap/bitmask/app.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index 72c03cb9..0517a071 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -39,6 +39,7 @@ # M:::::::::::~NMMM7???7MMMM:::::::::::::::::::::::NMMMI??I7MMMM:::::::::::::M # M::::::::::::::7MMMMMMM+:::::::::::::::::::::::::::?MMMMMMMZ:::::::::::::::M # (thanks to: http://www.glassgiant.com/ascii/) +import atexit import multiprocessing import os import sys @@ -73,6 +74,7 @@ def kill_the_children(): me = os.getpid() parent = psutil.Process(me) print "Killing all the children processes..." + for child in parent.get_children(recursive=True): try: child.terminate() @@ -81,7 +83,7 @@ def kill_the_children(): # XXX This is currently broken, but we need to fix it to avoid # orphaned processes in case of a crash. -# atexit.register(kill_the_children) +atexit.register(kill_the_children) def do_display_version(opts): |