[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.44-792-ge089177

Andreas Beckmann debian at abeckmann.de
Mon Jun 18 21:35:24 UTC 2012


The following commit has been merged in the develop branch:
commit 5fb8828aed7950eec803dec0f67211ab96122c12
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Jun 15 19:30:01 2012 +0200

    p-s: merge get_process_children() into terminate_subprocess()
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/piuparts-slave.py b/piuparts-slave.py
index e1e5450..906b486 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -440,18 +440,16 @@ def upgrade_testable(config, package, packages_files):
     else:
         return False
 
-def get_process_children(pid):
-    p = subprocess.Popen('ps --no-headers -o pid --ppid %d' % pid,
-           shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
-    stdout, stderr = p.communicate()
-    return [int(p) for p in stdout.split()]
 
 def run_test_with_timeout(cmd, maxwait, kill_all=True):
 
     def terminate_subprocess(p, kill_all):
         pids = [p.pid]
         if kill_all:
-            pids.extend(get_process_children(p.pid))
+            ps = subprocess.Popen(["ps", "--no-headers", "-o", "pid", "--ppid", "%d" % p.pid],
+                                  stdout = subprocess.PIPE)
+            stdout, stderr = ps.communicate()
+            pids.extend([int(pid) for pid in stdout.split()])
         if p.poll() is None:
             print 'Sending SIGINT...'
             try:

-- 
piuparts git repository



More information about the Piuparts-commits mailing list