summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2017-06-16 14:03:21 +0200
committerGitHub <noreply@github.com>2017-06-16 14:03:21 +0200
commit790b06e0c363ce1598deb3bde217c4685701b61d (patch)
tree4af1f440ba286c50483969c9a0780c5cec5fa831
parent8b5e94976d9850d352225e60e1d9428fc7c87735 (diff)
downloadspack-790b06e0c363ce1598deb3bde217c4685701b61d.tar.gz
spack-790b06e0c363ce1598deb3bde217c4685701b61d.tar.bz2
spack-790b06e0c363ce1598deb3bde217c4685701b61d.tar.xz
spack-790b06e0c363ce1598deb3bde217c4685701b61d.zip
bugfix: support EDITOR values with spaces (#4523)
- previous code called `which` on $EDITOR, but that doesn't work for EDITORs like `emacs -nw` or `emacsclient -t -nw`. - This patch just trusts EDITOR if it is set (same as previous behavior), and only uses the defaults if it's not.
-rw-r--r--lib/spack/spack/__init__.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 214bb09878..3f99c5581c 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -212,16 +212,16 @@ import spack.util.executable
from spack.util.executable import *
__all__ += spack.util.executable.__all__
-# User's editor from the environment
-# Default editors to use:
-_default_editors = ['vim', 'vi', 'emacs', 'nano']
+# Set up the user's editor
+# $EDITOR environment variable has the highest precedence
+editor = os.environ.get('EDITOR')
-# The EDITOR environment variable has the highest precedence
-if os.environ.get('EDITOR'):
- _default_editors.insert(0, os.environ.get('EDITOR'))
-
-editor = which(*_default_editors)
+# if editor is not set, use some sensible defaults
+if editor is not None:
+ editor = Executable(editor)
+else:
+ editor = which('vim', 'vi', 'emacs', 'nano')
if not editor:
default = default_editors[0]