1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-16 09:31:35 -05:00

made external executables return despite being in a different process. yay for IPC?

This commit is contained in:
XeonSquared 2019-07-28 19:46:43 +10:00
parent 6c45180119
commit 7347c93988

View File

@ -26,11 +26,17 @@ setmetatable(shenv,{__index=function(_,k)
if _G[k] then
return _G[k]
elseif fs.exists("/boot/exec/"..k..".lua") then
local rqid = string.format("shell-%d",math.random(1,99999))
return function(...)
local tA = {...}
local pid = os.spawn(function() loadfile("/boot/exec/"..k..".lua")(table.unpack(tA)) end,"/boot/exec/"..k..".lua")
local pid = os.spawn(function() computer.pushSignal(rqid,pcall(loadfile("/boot/exec/"..k..".lua"),table.unpack(tA))) end,"/boot/exec/"..k..".lua")
local tE = {}
repeat
coroutine.yield()
tE = {coroutine.yield()}
if tE[1] == rqid then
table.remove(tE,1)
return table.unpack(tE)
end
until tTasks[pid] == nil
end
end