From 4bd0276ab0491552247fa055921a23d2ffd9443c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Dec 2023 20:07:27 -0600 Subject: [PATCH] setup-env.sh: if exe contains qemu, use /proc/$$/comm instead --- share/spack/setup-env.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index a792127b29d..6cabf40594b 100644 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -232,6 +232,10 @@ _spack_determine_shell() { # If procfs is present this seems a more reliable # way to detect the current shell _sp_exe=$(readlink /proc/$$/exe) + # Qemu emulation has _sp_exe point to the emulator + if [ "${_sp_exe##*qemu*}" != "${_sp_exe}" ]; then + _sp_exe=$(cat /proc/$$/comm) + fi # Shell may contain number, like zsh5 instead of zsh basename ${_sp_exe} | tr -d '0123456789' elif [ -n "${BASH:-}" ]; then