1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-10 23:53:34 -05:00
OC-PsychOS2/exec/shell.lua

30 lines
725 B
Lua
Raw Normal View History

2019-07-14 06:52:56 -04:00
print(pcall(function()
2018-11-02 12:05:41 -04:00
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 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
io.write((os.getenv("PWD") or _VERSION).."> ")
2018-11-02 12:05:41 -04:00
tResult = {pcall(load(io.read(),"shell","t",shenv))}
if tResult[1] == true then table.remove(tResult,1) end
2018-11-02 12:05:41 -04:00
for k,v in pairs(tResult) do
print(v)
end
end
2019-07-14 06:52:56 -04:00
end))