From 1644e9effe528aa2f95de4c4726704028b0fabc8 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 6 Apr 2015 15:48:06 -0300 Subject: [bug] enable atexit subprocess termination - Resolves: #6426 - Resolves: #6681 --- src/leap/bitmask/app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/leap/bitmask/app.py') 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): -- cgit v1.2.3