From fb9258c0ae35c4201c670048b40408e747120606 Mon Sep 17 00:00:00 2001 From: buffet Date: Thu, 27 Aug 2020 14:26:58 +0000 Subject: [PATCH] Add tostring to IPC results --- kiwmi/luak/ipc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kiwmi/luak/ipc.c b/kiwmi/luak/ipc.c index 215ef1e..6bf6e2d 100644 --- a/kiwmi/luak/ipc.c +++ b/kiwmi/luak/ipc.c @@ -42,6 +42,18 @@ ipc_eval( kiwmi_command_send_done( command_resource, KIWMI_COMMAND_ERROR_SUCCESS, ""); } else { + lua_getglobal(L, "tostring"); + lua_insert(L, -2); + + if (lua_pcall(L, 1, 1, 0)) { + const char *error = lua_tostring(L, -1); + wlr_log(WLR_ERROR, "Error running IPC command: %s", error); + kiwmi_command_send_done( + command_resource, KIWMI_COMMAND_ERROR_FAILURE, error); + lua_pop(L, 1); + return; + } + kiwmi_command_send_done( command_resource, KIWMI_COMMAND_ERROR_SUCCESS, lua_tostring(L, -1)); }