|
|
|
@ -2230,18 +2230,15 @@ static int internal_getDir(lua_State *L)
|
|
|
|
|
|
|
|
|
|
static int internal_runCommand(lua_State *L)
|
|
|
|
|
{
|
|
|
|
|
CoreSuspender suspend;
|
|
|
|
|
luaL_checktype(L, 1, LUA_TSTRING);
|
|
|
|
|
CoreSuspender suspend;
|
|
|
|
|
std::string command = lua_tostring(L, 1);
|
|
|
|
|
buffered_color_ostream out;
|
|
|
|
|
command_result res = Core::getInstance().runCommand(out, command);
|
|
|
|
|
if (res != CR_OK)
|
|
|
|
|
{
|
|
|
|
|
lua_pushinteger(L, (int)res);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
auto fragments = out.fragments();
|
|
|
|
|
lua_newtable(L);
|
|
|
|
|
lua_pushinteger(L, (int)res);
|
|
|
|
|
lua_setfield(L, -2, "status");
|
|
|
|
|
int i = 1;
|
|
|
|
|
for (auto iter = fragments.begin(); iter != fragments.end(); iter++, i++)
|
|
|
|
|
{
|
|
|
|
|