From 2853bcc33002474cc9344ef82d1e10eed8cacd88 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 9 Sep 2012 18:23:30 +0200 Subject: [PATCH] [molecule.utils] remove RUNNING_PIDS set This ill conceived idea of killing stale chroot child processes does more harm than good and the idea has been inherited long time ago from the Catalyst codebase. Chroot processes are responsible of their cleanup. --- molecule.py | 7 ------- molecule/utils.py | 4 ---- 2 files changed, 11 deletions(-) diff --git a/molecule.py b/molecule.py index 78b47da..f370b7b 100644 --- a/molecule.py +++ b/molecule.py @@ -25,11 +25,6 @@ sys.path.insert(0,'molecule/') sys.path.insert(0,'.') import molecule.cmdline from molecule.handlers import Runner -from molecule.utils import RUNNING_PIDS - -def kill_pids(): - for pid in RUNNING_PIDS: - os.kill(pid, signal.SIGTERM) parse_data = molecule.cmdline.parse() if parse_data is None: @@ -46,12 +41,10 @@ for el in molecule_data_order: except KeyboardInterrupt: while True: my.kill() - kill_pids() break raise SystemExit(1) while True: my.kill() - kill_pids() break if rc != 0: raise SystemExit(rc) diff --git a/molecule/utils.py b/molecule/utils.py index cbb98c1..9b413eb 100644 --- a/molecule/utils.py +++ b/molecule/utils.py @@ -31,8 +31,6 @@ random.seed() from molecule.compat import convert_to_rawstring -RUNNING_PIDS = set() - def get_year(): """ @@ -153,9 +151,7 @@ def exec_chroot_cmd(args, chroot, pre_chroot = None, env = None): myargs = pre_chroot+args os.execvp(myargs[0], myargs) else: - RUNNING_PIDS.add(pid) rcpid, rc = os.waitpid(pid, 0) - RUNNING_PIDS.discard(pid) return rc def kill_chroot_pids(chroot, sig = signal.SIGTERM, sleep = False):