Fixed race condition in lua_execute().
Guard against null pointer that happens if a debugger's attached.
Buffer all piped output before extracting lines.