]> code.ossystems Code Review - openembedded-core.git/commitdiff
rt-tests: modernise subprocess: preexec_fn=os.setsid -> start_new_session=True
authorAndré Draszik <git@andred.net>
Mon, 3 Feb 2020 17:28:13 +0000 (17:28 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 4 Feb 2020 15:56:24 +0000 (15:56 +0000)
start_new_session was added to python3 subprocess in v3.2 and
is meant to take the place of the common use of preexec_fn to
call os.setsid() in the child - as done here.

Update to use the new equivalent.

Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-rt/rt-tests/files/rt_bmark.py

index 57b39b52a1e61ec3b5147751bd3920bba6e157d7..3b84447a0fdafa41c59e1704b48ae5162448c0d3 100755 (executable)
@@ -166,12 +166,12 @@ def start_stress(*args):
         log("  Command: '", stress_cmd_str, "'")
         log()
 
-        # preexec_fn=os.setsid causes stress to be executed in a separate
+        # start_new_session causes stress to be executed in a separate
         # session, => it gets a new process group (incl. children). It
         # can then be terminated using os.killpg in end_stress without
         # terminating this script.
 
-        p = subprocess.Popen(stress_cmd, preexec_fn=os.setsid)
+        p = subprocess.Popen(stress_cmd, start_new_session=True)
 
         return p