Commit 59252b60 authored by Tadeu Martins Chamuinho Bastos's avatar Tadeu Martins Chamuinho Bastos
Browse files

[OPENBUS-2344] Valores de saída dos na execução de 'busservices' e 'busadmin'...

[OPENBUS-2344] Valores de saída dos na execução de 'busservices' e 'busadmin' diferem dos valores de retorno dos scripts Lua correspondentes

- Recupera valores de retorno dos scripts Lua, retornando EXIT_FAILURE caso sejam diferentes de zero. 


git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/branches/02_00_00@143370 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 604098f2
......@@ -125,7 +125,7 @@ static int docall (lua_State *L, int narg) {
lua_pushcfunction(L, traceback); /* push traceback function */
lua_insert(L, base); /* put it under chunk and args */
signal(SIGINT, laction);
status = lua_pcall(L, narg, 0, base);
status = lua_pcall(L, narg, 1, base);
signal(SIGINT, SIG_DFL);
lua_remove(L, base); /* remove traceback function */
/* force a complete garbage collection in case of errors */
......@@ -149,6 +149,7 @@ static int getargs (lua_State *L, char **argv) {
struct Smain {
char **argv;
int status;
int retval;
};
......@@ -191,6 +192,8 @@ static int pmain (lua_State *L) {
}
}
s->status = report(L, status);
s->retval = lua_tointeger(L, -1);
lua_pop(L, 1);
return 0;
}
......@@ -208,5 +211,5 @@ int main (int argc, char **argv) {
status = lua_cpcall(L, &pmain, &s);
report(L, status);
lua_close(L);
return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
return (status || s.status || s.retval) ? EXIT_FAILURE : EXIT_SUCCESS;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment