[oe-commits] [openembedded-core] 05/10: oeqa: modernise subprocess: preexec_fn=os.setsid -> start_new_session=True

git at git.openembedded.org git at git.openembedded.org
Mon Feb 3 23:35:35 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit d99ef3005033beb93323dad13abab9a8d6e94161
Author: André Draszik <git at andred.net>
AuthorDate: Mon Feb 3 17:28:12 2020 +0000

    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 <git at andred.net>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 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(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/masterimage.py
index 0435dfa..0bf5917 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -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))
 
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index 63fc946..090b40a 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -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 = ''
diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py
index 49a0726..36c2ecb 100644
--- a/meta/lib/oeqa/utils/sshcontrol.py
+++ b/meta/lib/oeqa/utils/sshcontrol.py
@@ -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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list