[OE-core] [PATCH 2/2] runqemu: check exit code of 'ls -t'

Ed Bartosh ed.bartosh at linux.intel.com
Tue Jul 11 14:34:24 UTC 2017


Used check_output instead of Popen as it raises CalledProcessError
exception when command exits with non-zero exit code.

Catched the exception to produce user-friendly output.

[YOCTO #11719]

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 scripts/runqemu | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index c33741d..d44afc7 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -676,7 +676,10 @@ class BaseConfig(object):
             else:
                 cmd = 'ls -t %s/*.qemuboot.conf' %  deploy_dir_image
                 logger.info('Running %s...' % cmd)
-                qbs = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
+                try:
+                    qbs = subprocess.check_output(cmd, shell=True).decode('utf-8')
+                except subprocess.CalledProcessError as err:
+                    raise RunQemuError(err)
                 if qbs:
                     for qb in qbs.split():
                         # Don't use initramfs when other choices unless fstype is ramfs
-- 
2.1.4




More information about the Openembedded-core mailing list