Don't immediately raise an error when an editor is not found (#4587)
* Don't immediately raise an error when an editor is not found * If no editor is found, raise an error only if we try to use it.
This commit is contained in:
parent
1d82ccd25c
commit
ad1382e664
@ -223,12 +223,13 @@
|
|||||||
else:
|
else:
|
||||||
editor = which('vim', 'vi', 'emacs', 'nano')
|
editor = which('vim', 'vi', 'emacs', 'nano')
|
||||||
|
|
||||||
|
# If there is no editor, only raise an error if we actually try to use it.
|
||||||
if not editor:
|
if not editor:
|
||||||
default = default_editors[0]
|
def editor_not_found(*args, **kwargs):
|
||||||
msg = 'Default text editor, {0}, not found.\n'.format(default)
|
raise EnvironmentError(
|
||||||
msg += 'Please set the EDITOR environment variable to your preferred '
|
'No text editor found! Please set the EDITOR environment variable '
|
||||||
msg += 'text editor, or install {0}.'.format(default)
|
'to your preferred text editor.')
|
||||||
raise EnvironmentError(msg)
|
editor = editor_not_found
|
||||||
|
|
||||||
from spack.package import \
|
from spack.package import \
|
||||||
install_dependency_symlinks, flatten_dependencies, \
|
install_dependency_symlinks, flatten_dependencies, \
|
||||||
|
Loading…
Reference in New Issue
Block a user