Harden shell detection when procfs is available (#13950)
This commit is contained in:
parent
e366d5b559
commit
9ceec7e219
@ -215,11 +215,14 @@ _spack_pathadd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Determine which shell is being used
|
# Determine which shell is being used
|
||||||
#
|
|
||||||
_spack_determine_shell() {
|
_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
|
echo bash
|
||||||
elif [ -n "${ZSH_NAME:-}" ]; then
|
elif [ -n "${ZSH_NAME:-}" ]; then
|
||||||
echo zsh
|
echo zsh
|
||||||
|
Loading…
Reference in New Issue
Block a user