1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-26 04:57:24 -05:00

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

This commit is contained in:
XeonSquared 2019-07-28 12:45:38 +10:00
parent b8d3df6bee
commit ead102f131

View File

@ -3,7 +3,19 @@ local shenv = {}
function shenv.quit() function shenv.quit()
os.setenv("run",nil) os.setenv("run",nil)
end 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) print(_VERSION)
os.setenv("run",true) os.setenv("run",true)
while os.getenv("run") do while os.getenv("run") do