diff --git a/lbuild/ruletable.lua b/lbuild/ruletable.lua index 362101a..4a1a6e4 100644 --- a/lbuild/ruletable.lua +++ b/lbuild/ruletable.lua @@ -169,4 +169,15 @@ ruletable:addgenerator(function(name) return nil end) +runner.ondeadlock = function() + print("Deadlock!") + print("Incomplete operations:") + for i, v in pairs(ruletbl.rules) do + if v.state ~= "done" and v.state then + print(string.format("\t%s (%s)", i, v.state)) + end + end + error("deadlock") +end + return ruletable diff --git a/lbuild/runner.lua b/lbuild/runner.lua index bc3d1fa..5efa600 100644 --- a/lbuild/runner.lua +++ b/lbuild/runner.lua @@ -90,6 +90,9 @@ function runner:wait() op.pid = nil self.n = self.n - 1 else + if runner.ondeadlock then + runner.ondeadlock() + end error("Nothing running") end end