diff options
Diffstat (limited to 'apps/plugins/lua/loslib.c')
-rw-r--r-- | apps/plugins/lua/loslib.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/plugins/lua/loslib.c b/apps/plugins/lua/loslib.c index dce8811fbe..a0ea8e8c24 100644 --- a/apps/plugins/lua/loslib.c +++ b/apps/plugins/lua/loslib.c | |||
@@ -172,8 +172,11 @@ static int os_time (lua_State *L) { | |||
172 | 172 | ||
173 | 173 | ||
174 | static int os_exit (lua_State *L) { | 174 | static int os_exit (lua_State *L) { |
175 | lua_settop(L, 2); | ||
175 | int status = luaL_optint(L, 1, EXIT_SUCCESS); | 176 | int status = luaL_optint(L, 1, EXIT_SUCCESS); |
176 | lua_close(L); | 177 | if (status != EXIT_SUCCESS && lua_type (L, 2) != LUA_TSTRING) |
178 | lua_pushfstring(L, "exit (%d)", status); | ||
179 | lua_pushvalue(L, 1); /* put exit status on top of stack */ | ||
177 | exit(status); | 180 | exit(status); |
178 | return EXIT_SUCCESS; /* never reached, surpress warning */ | 181 | return EXIT_SUCCESS; /* never reached, surpress warning */ |
179 | } | 182 | } |