summaryrefslogtreecommitdiff
path: root/share/spack/setup-env.sh
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-12-16 23:51:58 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2019-12-16 14:51:58 -0800
commit9ceec7e21984db4ddb51756a6178e6c305b27238 (patch)
treeedf73ea29846a0e8a2b66bcd83d57b15e40486cb /share/spack/setup-env.sh
parente366d5b5591db1e39e4ccd99528b4cafb7e76518 (diff)
downloadspack-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/spack/setup-env.sh')
-rwxr-xr-xshare/spack/setup-env.sh9
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