diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-02-19 22:38:50 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-21 09:31:59 +0000 |
commit | 184a256931e8cdc7bea97a905c4e67a435964de0 (patch) | |
tree | eb8efff98ebffc29b3fc3af9dde4497bc2df1a77 /scripts/lib/devtool | |
parent | d2bc0cba5ca8a7220ffe1ef96acf856fe972ce7c (diff) | |
download | openembedded-core-184a256931e8cdc7bea97a905c4e67a435964de0.tar.gz openembedded-core-184a256931e8cdc7bea97a905c4e67a435964de0.tar.bz2 openembedded-core-184a256931e8cdc7bea97a905c4e67a435964de0.zip |
devtool / recipetool: use common code for launching editor
Looking at Chris Larson's code for starting the user's editor for
"recipetool newappend" it was slightly better than what I wrote for
"devtool edit-recipe" in that it checks VISUAL as well as EDITOR and
defaults to vi if neither are set, so break this out to its own function
and call it from both places. The broken out version passes shell=True
however in case it's a more complicated command rather than just a name
of an executable.
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')
-rw-r--r-- | scripts/lib/devtool/utilcmds.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py index a8f5e97833..18eddb78b0 100644 --- a/scripts/lib/devtool/utilcmds.py +++ b/scripts/lib/devtool/utilcmds.py @@ -24,6 +24,7 @@ import tempfile import logging import argparse import subprocess +import scriptutils from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError from devtool import parse_recipe @@ -48,17 +49,7 @@ def edit_recipe(args, config, basepath, workspace): raise DevtoolError("Recipe file for %s is not under the workspace" % args.recipename) - editor = os.environ.get('EDITOR', None) - if not editor: - raise DevtoolError("EDITOR environment variable not set") - - import subprocess - try: - subprocess.check_call('%s "%s"' % (editor, recipefile), shell=True) - except subprocess.CalledProcessError as e: - return e.returncode - - return 0 + return scriptutils.run_editor(recipefile) def configure_help(args, config, basepath, workspace): |