spack/lib/spack
Cory Bloor bb92ea59a2
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.
2022-07-07 17:08:15 +02:00
..
docs Documentation: Add SourceforgePackage to the build systems docs (#31473) 2022-07-07 14:30:22 +02:00
env Revert "strip -Werror: all specific or none (#30284)" (#30878) 2022-05-26 14:17:01 -07:00
external archspec: bump to v0.1.4 (#30856) 2022-06-07 08:51:34 +00:00
llnl Update decompression support on Windows (#25185) 2022-06-06 18:14:43 -07:00
spack Fix spack edit message when no editor installed (#31412) 2022-07-07 17:08:15 +02:00