ALPHA 3.0.0 - Added Inter-Process Communication and fixed the bug where the shell would continue taking in input when a command was still running.
This commit is contained in:
+15
-5
@@ -17,11 +17,21 @@ _G.shell.aliases = shellcfg["aliases"]
|
||||
local function runAsTask(path, ...)
|
||||
--ocelot.log("running " .. path .. " as coroutine")
|
||||
tsched.runAsTask(path, ...)
|
||||
local corIndex = #tsched.getTasks()
|
||||
local task = tsched.getTasks()[#tsched.getTasks()]
|
||||
repeat
|
||||
coroutine.yield()
|
||||
until tsched.getTasks()[corIndex] ~= task
|
||||
local pid = tsched.getTasks()[#tsched.getTasks()].id
|
||||
while true do
|
||||
local foundTask = false
|
||||
for _, task in pairs(tsched.getTasks()) do
|
||||
if task.id == pid then
|
||||
foundTask = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if foundTask then
|
||||
coroutine.yield()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _G.shell.run(command)
|
||||
|
||||
Reference in New Issue
Block a user