diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-16 11:11:04 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-16 11:11:04 -0300 |
| commit | 470dd56a89751efd6e53c0f28509b45631cd4fd4 (patch) | |
| tree | 66e6602773c56c3cb3acd07e6366f5986ac6c5f3 | |
| parent | 20d30bcd33ca932bc7a516ab751b195f03abd66f (diff) | |
| download | lua-470dd56a89751efd6e53c0f28509b45631cd4fd4.tar.gz lua-470dd56a89751efd6e53c0f28509b45631cd4fd4.tar.bz2 lua-470dd56a89751efd6e53c0f28509b45631cd4fd4.zip | |
'os.execute' (and similars) should return 'exit' and code in case
of success, too.
| -rw-r--r-- | lauxlib.c | 13 |
1 files changed, 6 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.231 2011/04/19 18:29:41 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.232 2011/05/03 16:01:57 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -251,13 +251,12 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) { | |||
| 251 | else { | 251 | else { |
| 252 | inspectstat(stat, what); /* interpret result */ | 252 | inspectstat(stat, what); /* interpret result */ |
| 253 | if (*what == 'e' && stat == 0) /* successful termination? */ | 253 | if (*what == 'e' && stat == 0) /* successful termination? */ |
| 254 | return luaL_fileresult(L, 1, NULL); | 254 | lua_pushboolean(L, 1); |
| 255 | else { /* return nil,what,code */ | 255 | else |
| 256 | lua_pushnil(L); | 256 | lua_pushnil(L); |
| 257 | lua_pushstring(L, what); | 257 | lua_pushstring(L, what); |
| 258 | lua_pushinteger(L, stat); | 258 | lua_pushinteger(L, stat); |
| 259 | return 3; | 259 | return 3; /* return true/nil,what,code */ |
| 260 | } | ||
| 261 | } | 260 | } |
| 262 | } | 261 | } |
| 263 | 262 | ||
