summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/scriptutils.py24
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
18import sys
19import os
20import logging
21import glob
22import argparse 18import argparse
23import subprocess 19import glob
24import tempfile 20import logging
25import shutil 21import os
26import random 22import random
23import shlex
24import shutil
27import string 25import string
26import subprocess
27import sys
28import tempfile
28 29
29def logger_create(name, stream=None): 30def 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
215def run_editor(fn, logger=None): 216def 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