mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
scriptutils: exit politely when no text editor available
devtool edit-recipe now has ugly tracebacks if executed without an editor available. This happens in the build containers whenever no text editor is available. subprocess.check_call will run text editing command with recipe path provided. It will wait for command to complete. If the return code was zero then return, otherwise raise CalledProcessError exception. This enhancement will suppress the traceback by catching the exception and prompt the error messages in a proper manner shown below: pokyuser@59c99c507238:/workdir/docker-dbg$ devtool edit-recipe ifupdown /bin/sh: 1: vi: not found ERROR: Execution of 'vi' failed: Command 'vi "/workdir/docker-dbg/workspace/recipes/ifupdown/ifupdown_0.8.16.bb"' returned non-zero exit status 127 [YOCTO #11434] (From OE-Core rev: c536ccfd162fc8871838fa229012c562e3f8e0d9) Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
50ef2da7ca
commit
2c035b266f
|
@ -216,8 +216,8 @@ def run_editor(fn):
|
|||
editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi'))
|
||||
try:
|
||||
return subprocess.check_call('%s %s' % (editor, params), shell=True)
|
||||
except OSError as exc:
|
||||
logger.error("Execution of editor '%s' failed: %s", editor, exc)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
logger.error("Execution of '%s' failed: %s" % (editor, exc))
|
||||
return 1
|
||||
|
||||
def is_src_url(param):
|
||||
|
|
Loading…
Reference in New Issue
Block a user