mirror of
https://github.com/lua/lua.git
synced 2025-01-28 06:03:00 +08:00
'os.execute' (and similars) should return 'exit' and code in case
of success, too.
This commit is contained in:
parent
20d30bcd33
commit
470dd56a89
13
lauxlib.c
13
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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user