'os.execute' (and similars) should return 'exit' and code in case

of success, too.
This commit is contained in:
Roberto Ierusalimschy
2011-06-16 11:11:04 -03:00
parent 20d30bcd33
commit 470dd56a89

View File

@@ -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 ** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -251,13 +251,12 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) {
else { else {
inspectstat(stat, what); /* interpret result */ inspectstat(stat, what); /* interpret result */
if (*what == 'e' && stat == 0) /* successful termination? */ if (*what == 'e' && stat == 0) /* successful termination? */
return luaL_fileresult(L, 1, NULL); lua_pushboolean(L, 1);
else { /* return nil,what,code */ else
lua_pushnil(L); lua_pushnil(L);
lua_pushstring(L, what); lua_pushstring(L, what);
lua_pushinteger(L, stat); lua_pushinteger(L, stat);
return 3; return 3; /* return true/nil,what,code */
}
} }
} }