Sorry, I should've elaborated. Notice the use of the "myArg" variable in the code example I referred to?
The first time you resume a coroutine, it initiates the associated function with the resume parameters. Eg:
local function myFunc(text)
print(text)
end
local myCo = coroutine.create(myFunc)
coroutine.resume(myCo, "Hello, World!") --> Prints "Hello, World!".
If shell is passed a parameter when you launch it, then it attempts to
run it. Your current setup is likely having it trying to find a script file called "key_up" or somesuch.
Simple fix is to redirect to your buffer and perform a single coroutine resume in redirector.addProgram():
function addProgram(path,buffer,name)
assert(fs.exists(path),"Nope.")
local f = loadstring("os.run({},'"..path.."')")
local co = coroutine.create(f)
term.redirect(buffer.tRedirect)
local ok, filter = coroutine.resume(co)
programs[name] = {name=name,routine=co,buffer=buffer,enabled=true,filter=filter}
end
I see that you've mostly finished correcting the rest of the event handling side of things, but you'll probably want to add handling for dead coroutines. The other issue is that some events really should be pushed through regardless as to whether a process is "enabled" - timers, for example. Pretty much anything that isn't user input, really.