]> code.ossystems Code Review - openembedded-core.git/commitdiff
runqemu: check exit code of 'ls -t'
authorEd Bartosh <ed.bartosh@linux.intel.com>
Tue, 11 Jul 2017 14:34:24 +0000 (17:34 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 17 Jul 2017 12:48:52 +0000 (13:48 +0100)
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@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/runqemu

index c33741d8048ae20c396def2b108ea8d7d57330d8..d44afc7e7a1af42ae69652ee644f12c054dd0e43 100755 (executable)
@@ -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