]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa: modernise subprocess: preexec_fn=os.setsid -> start_new_session=True
authorAndré Draszik <git@andred.net>
Mon, 3 Feb 2020 17:28:12 +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/lib/oeqa/controllers/masterimage.py
meta/lib/oeqa/core/target/ssh.py
meta/lib/oeqa/utils/sshcontrol.py

index 0435dfa125de36db07ded4f052852e4d90765df3..0bf5917e481dd6b98b2a07bee374ac6d90639c20 100644 (file)
@@ -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))
 
index 63fc9468b34866a1399d305e5421086f7ea8035b..090b40a8143503f321e0017245e7e1b518648ef2 100644 (file)
@@ -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 = ''
index 49a07264c67959e080d667b67bffb71a808c7137..36c2ecb3dba8cd2dc97a59fc6294ff1540ff29fe 100644 (file)
@@ -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)