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 end
table.insert(args, 1, true) table.insert(args, 1, true)
args.n = #args 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 if not thread then
return false, reason return false, reason
else
os.setenv ( '_', shell.resolve (program, "lua") )
end end
os.setenv("_", program)
local result = nil local result = nil
-- Emulate CC behavior by making yields a filtered event.pull() -- Emulate CC behavior by making yields a filtered event.pull()
while args[1] and coroutine.status(thread) ~= "dead" do 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) = { private def switchTo(value: Machine.State.Value) = {
val result = state.pop() val result = state.pop()
if (value == Machine.State.Stopping || value == Machine.State.Restarting) {
state.clear()
}
state.push(value) state.push(value)
if (value == Machine.State.Yielded || value == Machine.State.SynchronizedReturn) { if (value == Machine.State.Yielded || value == Machine.State.SynchronizedReturn) {
remainIdle = 0 remainIdle = 0