diff options
-rw-r--r-- | rpmio/macro.c | 12 | ||||
-rw-r--r-- | rpmio/rpmlua.c | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/rpmio/macro.c b/rpmio/macro.c index 0876ea88e..c1bb04334 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -1233,6 +1233,7 @@ expandMacro(MacroBuf mb, const char *src, size_t slen) } #ifdef WITH_LUA +#define LUA_FAILURE_OUTPUT "1" if (STREQ("lua", f, fn)) { rpmlua lua = NULL; /* Global state. */ const char *ls = s+sizeof("{lua:")-1; @@ -1242,9 +1243,14 @@ expandMacro(MacroBuf mb, const char *src, size_t slen) memcpy(scriptbuf, ls, lse-ls); scriptbuf[lse-ls] = '\0'; rpmluaPushPrintBuffer(lua); - if (rpmluaRunScript(lua, scriptbuf, NULL) == -1) - rc = 1; - printbuf = rpmluaPopPrintBuffer(lua); + if (rpmluaRunScript(lua, scriptbuf, NULL) == -1) { + printbuf = rpmluaPopPrintBuffer(lua); + rpmlog(RPMLOG_WARNING, _("lua: using fallback output '%s'\n"), LUA_FAILURE_OUTPUT); + printbuf = (char *)xcalloc(1, sizeof(LUA_FAILURE_OUTPUT)); + strcpy(printbuf, LUA_FAILURE_OUTPUT); + } else { + printbuf = rpmluaPopPrintBuffer(lua); + } if (printbuf) { mbAppendStr(mb, printbuf); free(printbuf); diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c index 8e6841d4e..53c0cf908 100644 --- a/rpmio/rpmlua.c +++ b/rpmio/rpmlua.c @@ -530,7 +530,7 @@ int rpmluaRunScript(rpmlua _lua, const char *script, const char *name) lua_pop(L, 1); ret = -1; } else if (lua_pcall(L, 0, 0, 0) != 0) { - rpmlog(RPMLOG_ERR, _("lua script failed: %s\n"), + rpmlog(RPMLOG_WARNING, _("lua script failed: %s\n"), lua_tostring(L, -1)); lua_pop(L, 1); ret = -1; |