commit 470dd56a89751efd6e53c0f28509b45631cd4fd4
parent 20d30bcd33ca932bc7a516ab751b195f03abd66f
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 16 Jun 2011 11:10:40 -0300
'os.execute' (and similars) should return 'exit' and code in case
of success, too.
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/lauxlib.c b/lauxlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.c,v 1.231 2011/04/19 18:29:41 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.232 2011/05/03 16:01:57 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -251,13 +251,12 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) {
else {
inspectstat(stat, what); /* interpret result */
if (*what == 'e' && stat == 0) /* successful termination? */
- return luaL_fileresult(L, 1, NULL);
- else { /* return nil,what,code */
+ lua_pushboolean(L, 1);
+ else
lua_pushnil(L);
- lua_pushstring(L, what);
- lua_pushinteger(L, stat);
- return 3;
- }
+ lua_pushstring(L, what);
+ lua_pushinteger(L, stat);
+ return 3; /* return true/nil,what,code */
}
}