diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-05-14 10:18:18 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-28 09:44:15 +0100 |
commit | b317d79fb7a058582f587e24463a1b67f38aec37 (patch) | |
tree | 041e4abb9457434f56df91f4e58a19eb80a158e2 /scripts/lib/devtool/__init__.py | |
parent | 8c9551a7a32036ac1f0bfba0b3f3dc24d006483e (diff) | |
download | ast2050-yocto-poky-b317d79fb7a058582f587e24463a1b67f38aec37.zip ast2050-yocto-poky-b317d79fb7a058582f587e24463a1b67f38aec37.tar.gz |
devtool: fix build env command execution error handling
If we execute an external command, we ought to prepare for the
possibility that it can fail and handle the failure appropriately. We
can especially expect this to happen when running bitbake in this
scenario. Ensure we return the appropriate exit code to the calling
process.
Fixes [YOCTO #7757].
(From OE-Core master rev: 98a716d79bfc5434a5b42d3ca683eab3eea30a41)
(From OE-Core rev: 2791fe9236f7173e6b998cf9b40fe238566ed8ee)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/__init__.py')
-rw-r--r-- | scripts/lib/devtool/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index 78ae0aa..4c0d539 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py @@ -43,12 +43,13 @@ def exec_build_env_command(init_path, builddir, cmd, watch=False, **options): if watch: if sys.stdout.isatty(): # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly) - cmd = 'script -q -c "%s" /dev/null' % cmd + cmd = 'script -e -q -c "%s" /dev/null' % cmd return exec_watch('%s%s' % (init_prefix, cmd), **options) else: return bb.process.run('%s%s' % (init_prefix, cmd), **options) def exec_watch(cmd, **options): + import bb if isinstance(cmd, basestring) and not "shell" in options: options["shell"] = True @@ -65,7 +66,11 @@ def exec_watch(cmd, **options): buf += out elif out == '' and process.poll() != None: break - return buf + + if process.returncode != 0: + raise bb.process.ExecutionError(cmd, process.returncode, buf, None) + + return buf, None def setup_tinfoil(): import scriptpath |