forked from izaya/OC-PsychOS2
made external executables return despite being in a different process. yay for IPC?
This commit is contained in:
parent
6c45180119
commit
7347c93988
@ -26,11 +26,17 @@ setmetatable(shenv,{__index=function(_,k)
|
|||||||
if _G[k] then
|
if _G[k] then
|
||||||
return _G[k]
|
return _G[k]
|
||||||
elseif fs.exists("/boot/exec/"..k..".lua") then
|
elseif fs.exists("/boot/exec/"..k..".lua") then
|
||||||
|
local rqid = string.format("shell-%d",math.random(1,99999))
|
||||||
return function(...)
|
return function(...)
|
||||||
local tA = {...}
|
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
|
repeat
|
||||||
coroutine.yield()
|
tE = {coroutine.yield()}
|
||||||
|
if tE[1] == rqid then
|
||||||
|
table.remove(tE,1)
|
||||||
|
return table.unpack(tE)
|
||||||
|
end
|
||||||
until tTasks[pid] == nil
|
until tTasks[pid] == nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user