From bab9b13cb8eed6c8c0285d6d4bbeb27489afc2a3 Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Thu, 3 Aug 2023 23:40:43 -0400 Subject: [PATCH] Push error when an error happens --- error.lua | 1 - init.lua | 3 ++- integration/pseudoManager/init.lua | 2 -- tests/runtests.lua | 4 +--- tests/threadtests.lua | 1 - 5 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 error.lua diff --git a/error.lua b/error.lua deleted file mode 100644 index 84c9b9f..0000000 --- a/error.lua +++ /dev/null @@ -1 +0,0 @@ -os.exit(2) \ No newline at end of file diff --git a/init.lua b/init.lua index aa7bb41..3d713e8 100644 --- a/init.lua +++ b/init.lua @@ -1789,6 +1789,7 @@ co_status = { ref.OnDeath:Fire(ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16) else ref.OnError:Fire(ref,ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16) + multi.error(ref, ret) end if i then table.remove(th,i) @@ -2392,8 +2393,8 @@ function multi.error(self, err) end if multi.defaultSettings.error then error("^^^ " .. multi:getCurrentProcess():getFullName() .. " " .. multi:getCurrentTask().Type .. "\n" .. debug.traceback().."\n") + os.exit(1) end - os.exit(1) end function multi.success(...) diff --git a/integration/pseudoManager/init.lua b/integration/pseudoManager/init.lua index 490cff9..91e0824 100644 --- a/integration/pseudoManager/init.lua +++ b/integration/pseudoManager/init.lua @@ -59,8 +59,6 @@ tab = split(tab) local id = 0 -print("Outerglobal",_G) - function multi:newSystemThread(name, func, ...) local env env = { diff --git a/tests/runtests.lua b/tests/runtests.lua index c3d7df7..77d0c02 100644 --- a/tests/runtests.lua +++ b/tests/runtests.lua @@ -179,10 +179,8 @@ runTest = thread:newFunction(function() ec = ec + os.execute("lua tests/threadtests.lua p") multi.print("Testing lanes threading") ec = ec + os.execute("lua tests/threadtests.lua l") - if ec > 0 then + if ec ~= 0 then os.exit(1) - else - os.exit() end end end) diff --git a/tests/threadtests.lua b/tests/threadtests.lua index 1f871c6..269b671 100644 --- a/tests/threadtests.lua +++ b/tests/threadtests.lua @@ -251,7 +251,6 @@ multi:newThread("Scheduler Thread",function() we_good = true multi:Stop() -- Needed in love2d tests to stop the main runner - os.exit() end).OnError(multi.error) multi.OnExit(function(err_or_errorcode)