Skip to content

Commit 5fbf84d

Browse files
author
Robert McLay
committed
adding unload state to tracing
1 parent acc563f commit 5fbf84d

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

README.new

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Lmod 7.8+
55
issue #380: Change DependencyCk mode from load to dependencyCk,
66
sType and tcl_mode remain load.
77
(7.8.3) Fixed problem with unbound variable __lmod_sh_dbg in module shell function definition
8+
(7.8.4) Add unload state to tracing.

src/Master.lua

+18-12
Original file line numberDiff line numberDiff line change
@@ -449,18 +449,7 @@ function M.unload(self,mA)
449449
local fullName = mname:fullName()
450450
local sn = mname:sn()
451451
local fn = mname:fn()
452-
if (tracing == "yes") then
453-
local stackDepth = frameStk:stackDepth()
454-
local indent = (" "):rep(stackDepth+1)
455-
local b = {}
456-
b[#b + 1] = indent
457-
b[#b + 1] = "Unloading: "
458-
b[#b + 1] = userName
459-
b[#b + 1] = " (fn: "
460-
b[#b + 1] = fn or "nil"
461-
b[#b + 1] = ")\n"
462-
shell:echo(concatTbl(b,""))
463-
end
452+
local state = ""
464453

465454
dbg.print{"Trying to unload: ", userName, " sn: ", sn,"\n"}
466455

@@ -469,6 +458,7 @@ function M.unload(self,mA)
469458
mt:remove(sn)
470459
registerUnloaded(mt:fullName(sn), mt:fn(sn))
471460
a[#a + 1] = true
461+
state = "inactive"
472462
elseif (mt:have(sn,"active")) then
473463

474464
dbg.print{"Master:unload: \"",userName,"\" from file: \"",fn,"\"\n"}
@@ -488,8 +478,24 @@ function M.unload(self,mA)
488478
hook.apply("unload",{fn = mname:fn(), modFullName = mname:fullName()})
489479
frameStk:pop()
490480
a[#a+1] = true
481+
state = "active"
491482
else
492483
a[#a+1] = false
484+
state = "non-existant"
485+
end
486+
if (tracing == "yes") then
487+
local stackDepth = frameStk:stackDepth()
488+
local indent = (" "):rep(stackDepth+1)
489+
local b = {}
490+
b[#b + 1] = indent
491+
b[#b + 1] = "Unloading: "
492+
b[#b + 1] = userName
493+
b[#b + 1] = " (state: "
494+
b[#b + 1] = state
495+
b[#b + 1] = ") (fn: "
496+
b[#b + 1] = fn or "nil"
497+
b[#b + 1] = ")\n"
498+
shell:echo(concatTbl(b,""))
493499
end
494500
end
495501

0 commit comments

Comments
 (0)