1
0
mirror of https://git.yoctoproject.org/poky synced 2026-04-20 11:28:58 +00:00

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 rev: 98a716d79bfc5434a5b42d3ca683eab3eea30a41)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2015-05-14 10:18:18 +01:00
committed by Richard Purdie
parent 18114bb8a6
commit 1bab18f26f
2 changed files with 24 additions and 7 deletions

View File

@@ -44,13 +44,14 @@ 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):
"""Run program with stdout shown on sys.stdout"""
import bb
if isinstance(cmd, basestring) and not "shell" in options:
options["shell"] = True
@@ -67,7 +68,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():
"""Initialize tinfoil api from bitbake"""