From 81fc7b95c922912a8c0cbd11a67590d6829f8bcd Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Tue, 4 Jul 2023 13:46:25 -0400 Subject: [PATCH] Fixed issue with errors not going through --- error.lua | 1 + init.lua | 1 + integration/effilManager/init.lua | 2 +- tests/threadtests.lua | 15 ++++++++------- 4 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 error.lua diff --git a/error.lua b/error.lua new file mode 100644 index 0000000..84c9b9f --- /dev/null +++ b/error.lua @@ -0,0 +1 @@ +os.exit(2) \ No newline at end of file diff --git a/init.lua b/init.lua index beb866d..4135359 100644 --- a/init.lua +++ b/init.lua @@ -2431,6 +2431,7 @@ multi.SetName = multi.setName local _os = os.exit function os.exit(n) + print("ERROR_"..n) multi.OnExit:Fire(n or 0) _os(n) end diff --git a/integration/effilManager/init.lua b/integration/effilManager/init.lua index 53818e6..f5c1277 100644 --- a/integration/effilManager/init.lua +++ b/integration/effilManager/init.lua @@ -1,6 +1,6 @@ local multi, thread = require("multi"):init{error=true} multi.error("Currntly not supported!") -os.exit() +os.exit(1) local effil = require("effil") -- I like some of the things that this library offers. diff --git a/tests/threadtests.lua b/tests/threadtests.lua index 1c2bd47..8a96c27 100644 --- a/tests/threadtests.lua +++ b/tests/threadtests.lua @@ -52,7 +52,7 @@ multi:newThread("Scheduler Thread",function() queue:push("done") end,"Passing some args", 1, 2, 3, true, {"Table"}).OnError(function(self,err) multi.error(err) - os.exit() + os.exit(1) end) if thread.hold(function() @@ -101,7 +101,7 @@ multi:newThread("Scheduler Thread",function() if val == multi.TIMEOUT then multi.error("SystemThreadedTables: Failed") - os.exit() + os.exit(1) end multi.success("SystemThreadedTables: Ok") @@ -126,7 +126,7 @@ multi:newThread("Scheduler Thread",function() if val == multi.TIMEOUT then multi.error("SystemThreadedJobQueues: Failed") - os.exit() + os.exit(1) end multi.success("SystemThreadedJobQueues: Ok") @@ -173,13 +173,14 @@ multi:newThread("Scheduler Thread",function() multi.success("SystemThreadedConnections: Ok") we_good = true - os.exit() + os.exit(1) end).OnError(multi.error) -multi.OnExit(function(err) +multi.OnExit(function(err_or_errorcode) + print("Final status!",err_or_errorcode) if not we_good then - multi.error("There was an error running some tests!") - os.exit(1) + multi.info("There was an error running some tests!") + return else multi.success("Tests complete!") end