Explorar el Código

made the shell spawn executed files as their own process and wait for them to complete

pull/1/head
XeonSquared hace 4 años
padre
commit
ead102f131
Se han modificado 1 ficheros con 13 adiciones y 1 borrados
  1. +13
    -1
      exec/shell.lua

+ 13
- 1
exec/shell.lua Ver fichero

@@ -3,7 +3,19 @@ local shenv = {}
function shenv.quit()
os.setenv("run",nil)
end
setmetatable(shenv,{__index=function(_,k) if _G[k] then return _G[k] elseif fs.exists("/boot/exec/"..k..".lua") then return loadfile("/boot/exec/"..k..".lua") end end})
setmetatable(shenv,{__index=function(_,k)
if _G[k] then
return _G[k]
elseif fs.exists("/boot/exec/"..k..".lua") then
return function(...)
local tA = {...}
local pid = os.spawn(function() loadfile("/boot/exec/"..k..".lua")(table.unpack(tA)) end,"/boot/exec/"..k..".lua")
repeat
coroutine.yield()
until tTasks[pid] == nil
end
end
end})
print(_VERSION)
os.setenv("run",true)
while os.getenv("run") do


Cargando…
Cancelar
Guardar