oeqa: modernise subprocess: preexec_fn=os.setsid -> start_new_session=True
PATCH 1/2 oeqa: modernise subprocess: preexec_fn=os.setsid -> start_new_session=True
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 <[email protected]>
--- meta/lib/oeqa/controllers/masterimage.py | 2 +- meta/lib/oeqa/core/target/ssh.py | 2 +- meta/lib/oeqa/utils/sshcontrol.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
meta/lib/oeqa/controllers/masterimage.py +1 -1
@@ -97,7 +97,7 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta if self.powercontrol_cmd: cmd = "%s %s" % (self.powercontrol_cmd, msg) try: - commands.runCmd(cmd, assert_error=False, preexec_fn=os.setsid, env=self.origenv) + commands.runCmd(cmd, assert_error=False, start_new_session=True, env=self.origenv) except CommandError as e: bb.fatal(str(e))
meta/lib/oeqa/core/target/ssh.py +1 -1
@@ -247,7 +247,7 @@ def SSHCall(command, logger, timeout=None, **opts): "stdin": None, "shell": False, "bufsize": -1, - "preexec_fn": os.setsid, + "start_new_session": True, } options.update(opts) output = ''
meta/lib/oeqa/utils/sshcontrol.py +1 -1
@@ -23,7 +23,7 @@ class SSHProcess(object): "stdin": None, "shell": False, "bufsize": -1, - "preexec_fn": os.setsid, + "start_new_session": True, } self.options = dict(self.defaultopts) self.options.update(options)
Signature · 1 line
2.23.0.rc1
PATCH 2/2 rt-tests: modernise subprocess: preexec_fn=os.setsid -> start_new_session=True
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 <[email protected]>
--- meta/recipes-rt/rt-tests/files/rt_bmark.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-rt/rt-tests/files/rt_bmark.py +2 -2
@@ -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
Signature · 1 line
2.23.0.rc1