diff --git a/utils/libcxx/util.py b/utils/libcxx/util.py index 46c09bf66..2fd95232a 100644 --- a/utils/libcxx/util.py +++ b/utils/libcxx/util.py @@ -253,24 +253,27 @@ def killProcessAndChildren(pid): TODO: Reimplement this without using psutil so we can remove our dependency on it. """ - import psutil - try: - psutilProc = psutil.Process(pid) - # Handle the different psutil API versions + if platform.system() == 'AIX': + subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), shell=True) + else: + import psutil try: - # psutil >= 2.x - children_iterator = psutilProc.children(recursive=True) - except AttributeError: - # psutil 1.x - children_iterator = psutilProc.get_children(recursive=True) - for child in children_iterator: + psutilProc = psutil.Process(pid) + # Handle the different psutil API versions try: - child.kill() - except psutil.NoSuchProcess: - pass - psutilProc.kill() - except psutil.NoSuchProcess: - pass + # psutil >= 2.x + children_iterator = psutilProc.children(recursive=True) + except AttributeError: + # psutil 1.x + children_iterator = psutilProc.get_children(recursive=True) + for child in children_iterator: + try: + child.kill() + except psutil.NoSuchProcess: + pass + psutilProc.kill() + except psutil.NoSuchProcess: + pass def executeCommandVerbose(cmd, *args, **kwargs):