Skip to content

Commit a46e77b

Browse files
committed
fix #3727
1 parent 6f3634a commit a46e77b

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- called from /init.lua
22
local raw_loadfile = ...
33

4-
_G._OSVERSION = "OpenOS 1.8.6"
4+
_G._OSVERSION = "OpenOS 1.8.7"
55

66
-- luacheck: globals component computer unicode _OSVERSION
77
local component = component

src/main/resources/assets/opencomputers/loot/openos/lib/process.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,19 @@ function process.load(path, env, init, name)
6868
if type(msg) == "table" and msg.reason == "terminated" then
6969
return msg.code or 0
7070
end
71-
local stack = debug.traceback():gsub("^([^\n]*\n)[^\n]*\n[^\n]*\n","%1")
72-
io.stderr:write(string.format("%s:\n%s", msg or "", stack))
73-
return 128 -- syserr
71+
return debug.traceback()
7472
end, ...)
7573
}
7674

77-
--result[1] is false if the exception handler also crashed
7875
if not result[1] and type(result[2]) ~= "number" then
79-
io.stderr:write("process library exception handler crashed: ", tostring(result[2]))
76+
-- run exception handler
77+
xpcall(function()
78+
local stack = result[2]:gsub("^([^\n]*\n)[^\n]*\n[^\n]*\n","%1")
79+
io.stderr:write(string.format("%s:\n%s", msg or "", stack))
80+
end,
81+
function(msg)
82+
io.stderr:write("process library exception handler crashed: ", tostring(msg))
83+
end)
8084
end
8185

8286
-- onError opens a file, you can't open a file without a process, we close the process last

0 commit comments

Comments
 (0)