Procházet zdrojové kódy

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

pull/1/head
XeonSquared před 4 roky
rodič
revize
7347c93988
1 změnil soubory, kde provedl 8 přidání a 2 odebrání
  1. +8
    -2
      exec/shell.lua

+ 8
- 2
exec/shell.lua Zobrazit soubor

@@ -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


Načítá se…
Zrušit
Uložit