diff options
Diffstat (limited to 'yocto-poky/scripts/lib/scriptutils.py')
-rw-r--r-- | yocto-poky/scripts/lib/scriptutils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/yocto-poky/scripts/lib/scriptutils.py b/yocto-poky/scripts/lib/scriptutils.py index e79a195b1..aef19d3d7 100644 --- a/yocto-poky/scripts/lib/scriptutils.py +++ b/yocto-poky/scripts/lib/scriptutils.py @@ -19,6 +19,8 @@ import sys import os import logging import glob +import argparse +import subprocess def logger_create(name): logger = logging.getLogger(name) @@ -100,3 +102,17 @@ def fetch_uri(d, uri, destdir, srcrev=None): os.chdir(olddir) return ret +def run_editor(fn): + if isinstance(fn, basestring): + params = '"%s"' % fn + else: + params = '' + for fnitem in fn: + params += ' "%s"' % fnitem + + 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) + return 1 |