]> code.ossystems Code Review - openembedded-core.git/commit
scriptutils: exit politely when no text editor available
authorChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Wed, 28 Jun 2017 01:59:17 +0000 (09:59 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 21 Jul 2017 11:36:36 +0000 (12:36 +0100)
commitc536ccfd162fc8871838fa229012c562e3f8e0d9
treea8ab0fcbf9666eb5d499cb11b380db75c77d646a
parent35403ba3707c3c8dd94bcc557eef6f7c66696bc5
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]

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/scriptutils.py