diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/scriptutils.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index 85b1c949bf..31e48ea4dc 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py | |||
@@ -15,16 +15,17 @@ | |||
15 | # with this program; if not, write to the Free Software Foundation, Inc., | 15 | # with this program; if not, write to the Free Software Foundation, Inc., |
16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17 | 17 | ||
18 | import sys | ||
19 | import os | ||
20 | import logging | ||
21 | import glob | ||
22 | import argparse | 18 | import argparse |
23 | import subprocess | 19 | import glob |
24 | import tempfile | 20 | import logging |
25 | import shutil | 21 | import os |
26 | import random | 22 | import random |
23 | import shlex | ||
24 | import shutil | ||
27 | import string | 25 | import string |
26 | import subprocess | ||
27 | import sys | ||
28 | import tempfile | ||
28 | 29 | ||
29 | def logger_create(name, stream=None): | 30 | def logger_create(name, stream=None): |
30 | logger = logging.getLogger(name) | 31 | logger = logging.getLogger(name) |
@@ -214,15 +215,14 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr | |||
214 | 215 | ||
215 | def run_editor(fn, logger=None): | 216 | def run_editor(fn, logger=None): |
216 | if isinstance(fn, str): | 217 | if isinstance(fn, str): |
217 | params = '"%s"' % fn | 218 | files = [fn] |
218 | else: | 219 | else: |
219 | params = '' | 220 | files = fn |
220 | for fnitem in fn: | ||
221 | params += ' "%s"' % fnitem | ||
222 | 221 | ||
223 | editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi')) | 222 | editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi')) |
224 | try: | 223 | try: |
225 | return subprocess.check_call('%s %s' % (editor, params), shell=True) | 224 | #print(shlex.split(editor) + files) |
225 | return subprocess.check_call(shlex.split(editor) + files) | ||
226 | except subprocess.CalledProcessError as exc: | 226 | except subprocess.CalledProcessError as exc: |
227 | logger.error("Execution of '%s' failed: %s" % (editor, exc)) | 227 | logger.error("Execution of '%s' failed: %s" % (editor, exc)) |
228 | return 1 | 228 | return 1 |