Unload all matching mods on "module unload" modfile cmd

When conflict_unload and auto_handling options are enabled, a "module
unload" modulefile command unloads all loaded modulefiles that match
module designation passed as argument. Same behavior than for conflict
modulefile command is then obtained.

Fixes #215
This commit is contained in:
Xavier Delaruelle
2024-07-02 20:05:43 +02:00
parent b20b032314
commit 6b1afd4984

View File

@@ -1427,7 +1427,17 @@ proc cmdModuleIntUnload {mode args} {
# enable auto unload and allow force mode if both auto handling and
# conflict unload features are enabled
if {[getConf conflict_unload] && [getConf auto_handling]} {
set ret [cmdModuleUnload conun match 1 s 0 {*}$args]
set conun_mod_list {}
foreach conun_arg $args {
# unload attempt in reverse load order
appendNoDupToList conun_mod_list {*}[lreverse\
[getLoadedMatchingName $conun_arg returnall]]
}
if {[llength $conun_mod_list]} {
set ret [cmdModuleUnload conun match 1 s 0 {*}$conun_mod_list]
} else {
set ret 0
}
# otherwise module required by others are not unloaded and force mode is
# disabled
} else {