diff options
author | Cory Bloor <Cordell.Bloor@amd.com> | 2022-07-07 09:08:15 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 17:08:15 +0200 |
commit | bb92ea59a26a5f4f6765c89e1c73398ba73d64d3 (patch) | |
tree | f3c2f940637af57f29a5965d95c5dd0d04ebac22 /bin | |
parent | 626b239c962c78ee6bb9d2b86b9c73c980d602d7 (diff) | |
download | spack-bb92ea59a26a5f4f6765c89e1c73398ba73d64d3.tar.gz spack-bb92ea59a26a5f4f6765c89e1c73398ba73d64d3.tar.bz2 spack-bb92ea59a26a5f4f6765c89e1c73398ba73d64d3.tar.xz spack-bb92ea59a26a5f4f6765c89e1c73398ba73d64d3.zip |
Fix spack edit message when no editor installed (#31412)
When no default editor is installed and no environment variable is set,
which_string would return None and this would be passed to os.execv
resulting in a TypeError. The message presented to the user would be:
Error: execv: path should be string, bytes or os.PathLike,
not NoneType
This change checks that which_string has returned successfully before
attempting to execute the result, resulting in a new error message:
Error: No text editor found! Please set the VISUAL and/or EDITOR
environment variable(s) to your preferred text editor.
It's not strictly necessary, but I've also changed try_exec to catch
all errors rather than just OSErrors. This would have provided slightly
more context for the original error message.
Diffstat (limited to 'bin')
0 files changed, 0 insertions, 0 deletions