diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2019-12-16 23:51:58 +0100 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2019-12-16 14:51:58 -0800 |
commit | 9ceec7e21984db4ddb51756a6178e6c305b27238 (patch) | |
tree | edf73ea29846a0e8a2b66bcd83d57b15e40486cb /share | |
parent | e366d5b5591db1e39e4ccd99528b4cafb7e76518 (diff) | |
download | spack-9ceec7e21984db4ddb51756a6178e6c305b27238.tar.gz spack-9ceec7e21984db4ddb51756a6178e6c305b27238.tar.bz2 spack-9ceec7e21984db4ddb51756a6178e6c305b27238.tar.xz spack-9ceec7e21984db4ddb51756a6178e6c305b27238.zip |
Harden shell detection when procfs is available (#13950)
Diffstat (limited to 'share')
-rwxr-xr-x | share/spack/setup-env.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index d5cad059a6..ab2655ddf6 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -215,11 +215,14 @@ _spack_pathadd() { } -# # Determine which shell is being used -# _spack_determine_shell() { - if [ -n "${BASH:-}" ]; then + if [ -f "/proc/$$/exe" ]; then + # If procfs is present this seems a more reliable + # way to detect the current shell + _sp_exe=$(readlink /proc/$$/exe) + basename ${_sp_exe} + elif [ -n "${BASH:-}" ]; then echo bash elif [ -n "${ZSH_NAME:-}" ]; then echo zsh |