Avoid potential assertion error.

This commit is contained in:
Florian Nücke 2014-07-05 15:03:56 +02:00
parent e4ebcbb6a4
commit fc16ceb935
2 changed files with 5 additions and 3 deletions

View File

@ -115,12 +115,11 @@ local function execute(env, command, ...)
end
table.insert(args, 1, true)
args.n = #args
local thread, reason = process.load(shell.resolve(program, "lua"), env, nil, command)
local thread, reason = process.load(program, env, nil, command)
if not thread then
return false, reason
else
os.setenv ( '_', shell.resolve (program, "lua") )
end
os.setenv("_", program)
local result = nil
-- Emulate CC behavior by making yields a filtered event.pull()
while args[1] and coroutine.status(thread) ~= "dead" do

View File

@ -721,6 +721,9 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
private def switchTo(value: Machine.State.Value) = {
val result = state.pop()
if (value == Machine.State.Stopping || value == Machine.State.Restarting) {
state.clear()
}
state.push(value)
if (value == Machine.State.Yielded || value == Machine.State.SynchronizedReturn) {
remainIdle = 0