[oe-commits] [openembedded-core] 45/48: runqemu: remove use of subprocess.run()

git at git.openembedded.org git at git.openembedded.org
Wed Sep 7 23:49:55 UTC 2016


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

commit db9a0aa76e3b2ba6967b4b7c32ae66862c801a9e
Author: Joshua Lock <joshua.g.lock at intel.com>
AuthorDate: Wed Sep 7 23:04:24 2016 +0100

    runqemu: remove use of subprocess.run()
    
    We aim to support Python 3.4+ whereas subprocess.run() was added
    in Python 3.5.
    Replace subprocess.run() with subprocess.check_output().
    
    Signed-off-by: Joshua Lock <joshua.g.lock at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/runqemu | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 0a56c60..cbc5cc6 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -858,10 +858,11 @@ class BaseConfig(object):
             cmd = 'bitbake -e'
 
         logger.info('Running %s...' % cmd)
-        proc = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
-        if proc.returncode != 0:
-            logger.warn("Couldn't run 'bitbake -e' to gather environment information")
-        self.bitbake_e = proc.stdout.decode('utf-8')
+        try:
+            self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8')
+        except subprocess.CalledProcessError as err:
+            self.bitbake_e = ''
+            logger.warn("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8'))
 
 def main():
     if len(sys.argv) == 1 or "help" in sys.argv:

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


More information about the Openembedded-commits mailing list