1
0
mirror of https://github.com/kepler155c/opus synced 2025-12-17 13:48:05 +00:00

transition to kernel

This commit is contained in:
kepler155c@gmail.com
2018-01-14 16:44:43 -05:00
parent 9de9452dd3
commit 30dd2a2b16
7 changed files with 113 additions and 111 deletions

View File

@@ -15,6 +15,7 @@ _G.kernel = {
window = _G.term.current(),
}
local fs = _G.fs
local kernel = _G.kernel
local os = _G.os
local term = _G.term
@@ -86,6 +87,9 @@ function Routine:resume(event, ...)
if #kernel.routines > 0 then
os.queueEvent('kernel_focus', kernel.routines[1].uid)
end
if self.haltOnExit then
kernel.halt()
end
end
return ok, result
end
@@ -229,3 +233,22 @@ function kernel.start()
end
term.redirect(kernel.terminal)
end
local function loadExtensions(runLevel)
local dir = 'sys/extensions'
local files = fs.list(dir)
table.sort(files)
for _,file in ipairs(files) do
local level, name = file:match('(%d).(%S+).lua')
--print(name)
if tonumber(level) <= runLevel then
local s, m = shell.run(fs.combine(dir, file))
if not s then
error(m)
end
end
end
end
local args = { ... }
loadExtensions(args[1] and tonumber(args[1]) or 7)