aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-19 22:38:50 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-21 09:31:59 +0000
commit184a256931e8cdc7bea97a905c4e67a435964de0 (patch)
treeeb8efff98ebffc29b3fc3af9dde4497bc2df1a77 /scripts/lib/recipetool
parentd2bc0cba5ca8a7220ffe1ef96acf856fe972ce7c (diff)
downloadopenembedded-core-contrib-184a256931e8cdc7bea97a905c4e67a435964de0.tar.gz
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/recipetool')
-rw-r--r--scripts/lib/recipetool/newappend.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/scripts/lib/recipetool/newappend.py b/scripts/lib/recipetool/newappend.py
index 5625a8ed52..bdf0693ec7 100644
--- a/scripts/lib/recipetool/newappend.py
+++ b/scripts/lib/recipetool/newappend.py
@@ -27,6 +27,7 @@ import os
import re
import subprocess
import sys
+import scriptutils
logger = logging.getLogger('recipetool')
@@ -96,12 +97,7 @@ def newappend(args):
return 1
if args.edit:
- editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi'))
- try:
- return subprocess.check_call([editor, append_path, recipe_path])
- except OSError as exc:
- logger.error("Execution of editor '%s' failed: %s", editor, exc)
- return 1
+ return scriptutils.run_editor([append_path, recipe_path])
else:
print(append_path)