mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-23 08:17:56 +02:00
Merge branch '327-modulecmd-set-_lmfiles_-and-loadedmodules-if-unset-by-lmod' into 'master'
Resolve "modulecmd: set _LMFILES_ and LOADEDMODULES if unset by Lmod" Closes #327 See merge request Pmodules/src!306
This commit is contained in:
@@ -985,9 +985,10 @@ subcommand_unload() {
|
||||
# the loop again, if it has been unset.
|
||||
local saved_home="${PMODULES_HOME}"
|
||||
|
||||
# nothing to do, if _LMFILES_ is not set. This can happen
|
||||
# if only Lua modules are loaded.
|
||||
[[ -v _LMFILES_ ]] || return 0
|
||||
if [[ ! -v _LMFILES_ ]]; then
|
||||
declare -x _LMFILES_=''
|
||||
declare -x LOADEDMODULES=''
|
||||
fi
|
||||
|
||||
IFS=':' read -r -a _lmfiles_ <<< "${_LMFILES_}"
|
||||
local arg
|
||||
@@ -1026,6 +1027,10 @@ subcommand_unload() {
|
||||
PMODULES_HOME="${saved_home}"
|
||||
export_env 'PMODULES_HOME'
|
||||
fi
|
||||
if [[ ! -v _LMFILES_ ]]; then
|
||||
declare -x _LMFILES_=''
|
||||
declare -x LOADEDMODULES=''
|
||||
fi
|
||||
set_lmfiles
|
||||
export_env 'LOADEDMODULES' '_LMFILES_'
|
||||
EnvMustBeSaved='yes'
|
||||
@@ -3675,6 +3680,12 @@ if [[ ! -v Version ]] || \
|
||||
_LMFILES_
|
||||
fi
|
||||
|
||||
# re-define these variables. Lmod muught have unset them!
|
||||
if [[ ! -v _LMFILES_ ]]; then
|
||||
declare -x _LMFILES_=''
|
||||
declare -x LOADEDMODULES=''
|
||||
fi
|
||||
|
||||
# we need to handle help text and options for sub-cmd aliases
|
||||
SubCommand=${Subcommands[${SubCommand}]}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user