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.
This commit is contained in:
Todd Gamblin 2017-06-16 14:03:21 +02:00 committed by GitHub
parent 8b5e94976d
commit 790b06e0c3

View File

@ -212,16 +212,16 @@
from spack.util.executable import * from spack.util.executable import *
__all__ += spack.util.executable.__all__ __all__ += spack.util.executable.__all__
# User's editor from the environment
# Default editors to use: # Set up the user's editor
_default_editors = ['vim', 'vi', 'emacs', 'nano'] # $EDITOR environment variable has the highest precedence
editor = os.environ.get('EDITOR')
# The EDITOR environment variable has the highest precedence # if editor is not set, use some sensible defaults
if os.environ.get('EDITOR'): if editor is not None:
_default_editors.insert(0, os.environ.get('EDITOR')) editor = Executable(editor)
else:
editor = which(*_default_editors) editor = which('vim', 'vi', 'emacs', 'nano')
if not editor: if not editor:
default = default_editors[0] default = default_editors[0]